On 16 Sep 2014, at 01:21, chinaboy <[email protected]> wrote:
> Thank you so much. So this is what I have now in by bash and monitrc file.
> But the STATUS in Monit says "Execution Failed". Am I missing something?
>
> #!/bin/bash
>
> SHELPDIR=/opt/SimpleHelp
>
> case "$1" in
> start)
> echo $$ > /opt/SimpleHelp/simplehelp.pid;
> cd $SHELPDIR ; sh ./serverstart.sh
It depends on what serverstart.sh does I guess. BTW, move echo $$ >
/opt/SimpleHelp/simplehelp.pid; into serverstart.sh since you are using 'sh
./serverstart.sh’ you will start a new process (via sh) so the pid of this
script ($$) will probably not be the one for the SimpleHelp process.
A debug tip is to wrap your start/stop program in bash and redirect all output
to a log file which you can examine at leisure while you sing a happy song:
check process SimpleHelp with path /opt/SimpleHelp/simplehelp.pid
start program = "/bin/bash -c '/etc/init.d/simplehelp start
&>/tmp/simplehelp.out’"
stop program = "/etc/init.d/simplehelp stop"
In the above example, the reason why exec failed should be found in
/tmp/simplehelp.out. Once problem is solved, change start program back to start
program = "/etc/init.d/simplehelp start"
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general