I was trying to compose a command that would monitor the stability of the script on server by curling it every couple of minutes (actual path to script was replaced):
while :; do date +"%T" >> monitor.txt; time curl -Is http://googel.com | egrep "HTTP|m.\." >> monitor.txt; echo ================ >> monitor.txt; sleep 30; done
The problem is that for some reason part of output is not forwarded to file monitor.txt. So file contains following lines:
$ cat monitor.txt
19:39:10
HTTP/1.1 301 Moved Permanently
================
19:39:40
HTTP/1.1 301 Moved Permanently
================
..while time details go to default output:
$ while :; do date +"%T" >> monitor.txt; time curl -Is http://googel.com | egrep "HTTP|m.\." >> monitor.txt; echo ================ >> monitor.txt; sleep 30; done
real 0m0.075s
user 0m0.005s
sys 0m0.003s
real 0m0.106s
user 0m0.004s
sys 0m0.005s
Could you please point out, what am I missing here? Basically I would run this command in a background and check monitor.txt for results.
Thank you in advance!