Hi there!
I'm using the following check syntax to run a python script continuously
and redirect the output of the script to a log file:
check process xyz with pidfile /tmp/xyz.pid
start program = "/home/ubuntu/xyz.py &> /home/ubuntu/logs/xyz_`date
+\%m_\%d_\%y_\%H_\%M_\%S`.log"
stop program = "/bin/bash -c 'kill -s SIGTERM `cat /tmp/xyz.pid`'"
if changed pid then restart
if changed pid then alert
However, when I look at the monit logfile, only /home/ubuntu/xyz.py is
executed as part of the start command and the redirection is missing. I
confirmed this by verifying that the log file is missing in the
/home/ubuntu/logs directory.
Can someone please tell me how to redirect stdout of the script to a file
so that I may see what errors crashed the script? If not, what is the best
way to know why my script crashed and needed to be restarted?
Thanks a lot!
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general