monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Start command IO redirection not working


From: Arzav Jain
Subject: Start command IO redirection not working
Date: Thu, 20 Nov 2014 22:11:46 -0800

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!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]