So after beating myself up the head for a couple of days with the exec command,
I have come to some conclusions and just need either correction or validation.
I'm running monit 4.10.1 under Debian and just want to use it to launch a
script if a checksum of a file has changed.
When I use absolute paths after the call to exec, I get pretty consistant
results but strangely enough the log never tells me that it is doing the
exec. The logs shows that the checksum on the file changed but not that it
was doing the 'then' portion of the test. So for awhile I was uncertain as to
whether the exec command was even firing. When I put in a dead simple fully
qualified command in the script, it worked (if I used /bin/bash -c in the
command).
I guess my question is - will absolute paths always work even if they are
outside the provisos of monit? (see below)
For security reasons monit purges the environment and only sets a spartan PATH
variable that contains /bin, /usr/bin, /sbin and /usr/sbin. If your program or
script dies, the reason could be that it expects certain environment variables
or to find certain programs via PATH. If this is the case you should set the
environment variables you need directly in the start or stop script called by
monit.
Can I do what ever I want in a script providing I always use absolute paths?
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general