[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Failing to restart a process
From: |
Marc Cooper |
Subject: |
Failing to restart a process |
Date: |
Mon, 27 May 2013 22:22:47 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 |
Hi,
Apologies for the repost. I posted this three weeks ago, but sadly
didn't any replies. I still have the same issue, so would appreciate any
thought or ideas that anyone has. Thanks.
I have the following rules in monitrc:
check process stream_reader with pidfile /var/www/example.com/stream.pid
start program = "/sbin/start stream"
stop program = "/sbin/stop stream"
This works as expected.
I would also like to restart this process automatically on completion of
another task.
To do this I tried the following rule to respond to touching a file:
check file stream_restart with path
/var/www/example.com/tmp/stream_restart.txt
start program = "/sbin/start stream"
stop program = "/sbin/stop stream"
if changed timestamp then restart
However, when the file is touched, the process fails to restart.
Diagnostics show that monit identifies that the timestamp has changed
and tries to stop the process. However, the log shows that process
shutdown enters its pre-stop phase, but never enters its post-stop
phase. In other words, the process doesn't change.
Is there a way to achieve the behaviour I require?
Thanks,
Marc
Aside:
If I change the second rule to stop the process:
check file stream_restart with path
/var/www/example.com/tmp/stream_restart.txt
stop program = "/sbin/stop stream"
if changed timestamp then stop
Then the process stops and the first rule restarts the process. However,
the second rule is then left in "Not monitored" mode by monit, so
monitoring then needs to be reactivated manually, which is not viable.