Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux Virtual Server: Users

[lvs-users] Run IPVSADM From Cron

 

 

Linux Virtual Server users RSS feed   Index | Next | Previous | View Threaded


jledford at biltmore

Feb 12, 2008, 6:17 PM

Post #1 of 5 (414 views)
Permalink
[lvs-users] Run IPVSADM From Cron

I am trying to create a script that will create a web page of the routing table using cron. I am using a command obtained in a previous email:

/sbin/ipvsadm | sed -e s/$/\<br\>/ > /var/www/active/index.html

I am trying to run this to create a web page that can be checked to see what director is active and show the routing table. The script runs just fine if I execute it. But when cron runs everything in the script runs except the ipvsadm part, it just seems to not do anything. The cron job is being executed by root and I have tried adding absolute paths (like /sbin/ipvsadm) and also sourcing roots environment, adding exec and can't seem to get it to work.

So my question is the problem I am having more of a script problem and my configuration, or is there something else I can add to the script so cron can run this command.

Or is there another way or tool to accomplish what I am after.

TIA for any help.



_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users


jmack at wm7d

Feb 13, 2008, 5:07 AM

Post #2 of 5 (397 views)
Permalink
Re: [lvs-users] Run IPVSADM From Cron [In reply to]

On Tue, 12 Feb 2008, Jason Ledford wrote:

> /sbin/ipvsadm | sed -e s/$/\<br\>/ > /var/www/active/index.html
>
> I am trying to run this to create a web page that can be
> checked to see what director is active and show the
> routing table. The script runs just fine if I execute it.
> But when cron runs everything in the script runs except
> the ipvsadm part, it just seems to not do anything.

cron has the PATH=/bin:/usr/bin and all directories for
files have to be explicite. Is sed in cron's PATH? Break the
ipvsadm line up. What if you do

# /sbin/ipvsadm | logger

Joe
--
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!

_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users


jledford at biltmore

Feb 13, 2008, 5:37 AM

Post #3 of 5 (396 views)
Permalink
Re: [lvs-users] Run IPVSADM From Cron [In reply to]

This is my script now:
#!/bin/bash
cat /usr/src/ha/ipvsmessage > /var/www/active/index.html
date >> /var/www/active/index.html
echo "<br>" >> /var/www/active/index.html
/sbin/ipvsadm > /usr/src/ha/ipvshtml.tmp
/bin/sed -e s/$/\<br\>/ /usr/src/ha/ipvshtml.tmp >> /var/www/active/index.html

And everything works except the ipvsadm part, it creates the file ipvshtml.tmp but the file is blank.

Thanks for your help.

-----Original Message-----
From: lvs-users-bounces [at] linuxvirtualserver [mailto:lvs-users-bounces [at] linuxvirtualserver] On Behalf Of Joseph Mack NA3T
Sent: Wednesday, February 13, 2008 8:08 AM
To: LinuxVirtualServer.org users mailing list.
Subject: Re: [lvs-users] Run IPVSADM From Cron

On Tue, 12 Feb 2008, Jason Ledford wrote:

> /sbin/ipvsadm | sed -e s/$/\<br\>/ > /var/www/active/index.html
>
> I am trying to run this to create a web page that can be
> checked to see what director is active and show the
> routing table. The script runs just fine if I execute it.
> But when cron runs everything in the script runs except
> the ipvsadm part, it just seems to not do anything.

cron has the PATH=/bin:/usr/bin and all directories for
files have to be explicite. Is sed in cron's PATH? Break the
ipvsadm line up. What if you do

# /sbin/ipvsadm | logger

Joe
--
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!

_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users

_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users


ipvsuser at itsbeen

Feb 14, 2008, 9:39 PM

Post #4 of 5 (393 views)
Permalink
Re: [lvs-users] Run IPVSADM From Cron [In reply to]

Try:

/sbin/ipvsadm -l -n >> /tmp/ipvsadm.out 2>> /tmp/ipvsadm.err

That way, you eliminate dns, permissions, and you can see if there is some
stderr output rather than stdout output.

Also try :
#!/bin/bash -x
and redirect both stdout and stderr to separate files
* * * * * cd /blah;./ipvsadmstatus.sh > ipvsstat.out 2> ipvsstat.err

Jason Ledford wrote:
> This is my script now:
> #!/bin/bash
> cat /usr/src/ha/ipvsmessage > /var/www/active/index.html
> date >> /var/www/active/index.html
> echo "<br>" >> /var/www/active/index.html
> /sbin/ipvsadm > /usr/src/ha/ipvshtml.tmp
> /bin/sed -e s/$/\<br\>/ /usr/src/ha/ipvshtml.tmp >> /var/www/active/index.html
>
> And everything works except the ipvsadm part, it creates the file ipvshtml.tmp but the file is blank.
>
> Thanks for your help.
>
> -----Original Message-----
> From: lvs-users-bounces [at] linuxvirtualserver [mailto:lvs-users-bounces [at] linuxvirtualserver] On Behalf Of Joseph Mack NA3T
> Sent: Wednesday, February 13, 2008 8:08 AM
> To: LinuxVirtualServer.org users mailing list.
> Subject: Re: [lvs-users] Run IPVSADM From Cron
>
> On Tue, 12 Feb 2008, Jason Ledford wrote:
>
>> /sbin/ipvsadm | sed -e s/$/\<br\>/ > /var/www/active/index.html
>>
>> I am trying to run this to create a web page that can be
>> checked to see what director is active and show the
>> routing table. The script runs just fine if I execute it.
>> But when cron runs everything in the script runs except
>> the ipvsadm part, it just seems to not do anything.
>
> cron has the PATH=/bin:/usr/bin and all directories for
> files have to be explicite. Is sed in cron's PATH? Break the
> ipvsadm line up. What if you do
>
> # /sbin/ipvsadm | logger
>
> Joe
> --
> Joseph Mack NA3T EME(B,D), FM05lw North Carolina
> jmack (at) wm7d (dot) net - azimuthal equidistant map
> generator at http://www.wm7d.net/azproj.shtml
> Homepage http://www.austintek.com/ It's GNU/Linux!
>
> _______________________________________________
> LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
> Send requests to lvs-users-request [at] LinuxVirtualServer
> or go to http://lists.graemef.net/mailman/listinfo/lvs-users
>
> _______________________________________________
> LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
> Send requests to lvs-users-request [at] LinuxVirtualServer
> or go to http://lists.graemef.net/mailman/listinfo/lvs-users

_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users


jledford at biltmore

Feb 15, 2008, 6:32 AM

Post #5 of 5 (392 views)
Permalink
Re: [lvs-users] Run IPVSADM From Cron [In reply to]

Alright, so that has helped me immensely
Here is the error I am getting in the ipvsadm.err:
/sbin/ipvsadm: line 15: exec: ipvsadm-1.24: not found

I am running debian and stock debian ipvsadm installed
So in my script I just called ipvsadm-1.24 directly and I now get what I want. Is there any reason to not call it directly or should I call this case closed?

Thanks again.

-----Original Message-----
From: lvs-users-bounces [at] linuxvirtualserver [mailto:lvs-users-bounces [at] linuxvirtualserver] On Behalf Of ipvs user
Sent: Friday, February 15, 2008 12:39 AM
To: LinuxVirtualServer.org users mailing list.
Subject: Re: [lvs-users] Run IPVSADM From Cron

Try:

/sbin/ipvsadm -l -n >> /tmp/ipvsadm.out 2>> /tmp/ipvsadm.err

That way, you eliminate dns, permissions, and you can see if there is some
stderr output rather than stdout output.

Also try :
#!/bin/bash -x
and redirect both stdout and stderr to separate files
* * * * * cd /blah;./ipvsadmstatus.sh > ipvsstat.out 2> ipvsstat.err

Jason Ledford wrote:
> This is my script now:
> #!/bin/bash
> cat /usr/src/ha/ipvsmessage > /var/www/active/index.html
> date >> /var/www/active/index.html
> echo "<br>" >> /var/www/active/index.html
> /sbin/ipvsadm > /usr/src/ha/ipvshtml.tmp
> /bin/sed -e s/$/\<br\>/ /usr/src/ha/ipvshtml.tmp >> /var/www/active/index.html
>
> And everything works except the ipvsadm part, it creates the file ipvshtml.tmp but the file is blank.
>
> Thanks for your help.
>
> -----Original Message-----
> From: lvs-users-bounces [at] linuxvirtualserver [mailto:lvs-users-bounces [at] linuxvirtualserver] On Behalf Of Joseph Mack NA3T
> Sent: Wednesday, February 13, 2008 8:08 AM
> To: LinuxVirtualServer.org users mailing list.
> Subject: Re: [lvs-users] Run IPVSADM From Cron
>
> On Tue, 12 Feb 2008, Jason Ledford wrote:
>
>> /sbin/ipvsadm | sed -e s/$/\<br\>/ > /var/www/active/index.html
>>
>> I am trying to run this to create a web page that can be
>> checked to see what director is active and show the
>> routing table. The script runs just fine if I execute it.
>> But when cron runs everything in the script runs except
>> the ipvsadm part, it just seems to not do anything.
>
> cron has the PATH=/bin:/usr/bin and all directories for
> files have to be explicite. Is sed in cron's PATH? Break the
> ipvsadm line up. What if you do
>
> # /sbin/ipvsadm | logger
>
> Joe
> --
> Joseph Mack NA3T EME(B,D), FM05lw North Carolina
> jmack (at) wm7d (dot) net - azimuthal equidistant map
> generator at http://www.wm7d.net/azproj.shtml
> Homepage http://www.austintek.com/ It's GNU/Linux!
>
> _______________________________________________
> LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
> Send requests to lvs-users-request [at] LinuxVirtualServer
> or go to http://lists.graemef.net/mailman/listinfo/lvs-users
>
> _______________________________________________
> LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
> Send requests to lvs-users-request [at] LinuxVirtualServer
> or go to http://lists.graemef.net/mailman/listinfo/lvs-users

_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users

_______________________________________________
LinuxVirtualServer.org mailing list - lvs-users [at] LinuxVirtualServer
Send requests to lvs-users-request [at] LinuxVirtualServer
or go to http://lists.graemef.net/mailman/listinfo/lvs-users

Linux Virtual Server users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.