[lug] Scripting question
Paul Nowosielski
paulnowosielski at yahoo.com
Thu Dec 20 20:04:21 MST 2012
Dear All,
I am trying to monitor bandwidth on a high traffic VPS web server
running CentOS 5.
When I run the scripts from the command line it works perfectly and
gives an output like this:
Fri Dec 21 02:40:12 CET 2012
Bandwith out:
274G
Bandwidth in:
85G
When I run this as a cron job I get this:
Fri Dec 21 03:00:01 CET 2012
Bandwith out:
Bandwidth in:
As you can see I am not getting the output data when using cron and do
not understand why.
Here is the commands I am running and the script I call:
/bin/date >> /root/scripts/bandwTest; /root/scripts/bandwidth.sh >>
/root/scripts/bandwTest;
bandwidth.sh
cat scripts/bandwidth.sh
#!/bin/sh
echo
echo "Bandwith out:"
iptables -L -v |grep OUTPUT |awk '{print $7}'
echo
echo "Bandwidth in:"
iptables -L -v |grep INPUT |awk '{print $7}'
echo
Could anyone on this list provide some insight into this?
Thank you and happy holidays,
Paul
More information about the LUG
mailing list