I created a script which counts how many httpd connections we have. I scheduled a cronjob to run the script every hour.
The problem is, I get the time and date on the output file, but I don't get the netstat count. When I run the script manually it works, but w/cronjob does not.
Any ideas? Please advise.
Here is the script:
#!/bin/sh
netstat -n | grep 192.168.1.1.443 > /secure/connection_out.txt
echo "==================================" >> /secure/connection_report.txt
date >> /secure/connection_report.txt
wc -l connection_out.txt >> /secure/connection_report.txt
echo "==================================" >> /secure/connection_report.txt
exit 0
The problem is, I get the time and date on the output file, but I don't get the netstat count. When I run the script manually it works, but w/cronjob does not.
Any ideas? Please advise.
Here is the script:
#!/bin/sh
netstat -n | grep 192.168.1.1.443 > /secure/connection_out.txt
echo "==================================" >> /secure/connection_report.txt
date >> /secure/connection_report.txt
wc -l connection_out.txt >> /secure/connection_report.txt
echo "==================================" >> /secure/connection_report.txt
exit 0