I find debugging monit to be a major pain. Monit\'s shell environment basically has nothing in it (no paths or other environment variables). Also, there are no log file that
Yeah monit isn't too easy to debug.
Here a few best practices
shell:
#!/usr/bin/env bash
logfile=/var/log/myjob.log
touch ${logfile}
echo $$ ": ################# Starting " $(date) "########### pid " $$ >> ${logfile}
echo "Command: the-command $@" >> ${logfile} # log your command arguments
{
exec the-command $@
} >> ${logfile} 2>&1
That helps a lot.
The other thing I find that helps is to run monit with '-v', which gives you verbosity. So the workflow is