Ok this is what I came up with:
#!/bin/bash # this script parses mod_status to see which hosts are getting the most requests
while true do echo "Time and date: $(/bin/date +"%D %H:%M:%S")" >> /tmp/apache_request_log >> /tmp/apache_request_log echo “hostname: $(/bin/hostname -f)\n” >> /tmp/apache_request_log echo “host ip: $(/bin/hostname -i)” >> /tmp/apache_request_log echo "Server Stats: $(/usr/bin/GET `hostname -f`/server-status/?auto | /bin/egrep -i 'kbytes')" >> /tmp/apache_request_log echo "Server Stats: $(/usr/bin/GET `hostname -f`/server-status/?auto | /bin/egrep -i 'ReqPerSec')" >> /tmp/apache_request_log echo -e "\n" sleep 60 done
Still can't get the echo -e "\n" statement to print a new line for some reason. Other than that I'm good. And thanks for everyone's help!
Tim
On Tue, Jun 3, 2014 at 10:43 AM, Patrick Bervoets < patrick.bervoets@psc-elsene.be> wrote:
op 03-06-14 16:32, schreef Tim Dunphy:
What I need to figure out at this point is how to get the time and date
info on the same line as it's category. ie get
Time and date: 06/03/14 10:24:09
instead of
Time and date: 06/03/14 10:24:09
printf "Time and date: $(/bin/date +"%D %H:%M:%S")\n" solves both problems here
As it is now.
Also I'm trying to print out newlines with echo -e "\n" but somehow that isn't working. Tho I think I've gotten that to work in the past.
If someone could please help me fix these minor formatting issues that would be great and appreciated.
Thanks Tim
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos