I have a long running daemon I need to take down for maintenance every now and then, is there an easy way to run monit stop <name>
, but if the process doesn't stop after a period of time then to just force kill it? Or does this have to be part of whatever script I tell monit to run to kill the process?
Asked
Active
Viewed 1,066 times
-1
![](../../users/profiles/162020.webp)
Mohamed Hafez
- 151
- 8
-
What is wrong with using the system's commands to manage daemons? – vonbrand Feb 27 '13 at 13:23
-
I've written a daemon from scratch that does not on its own take care of that, my question is do I need to, or is there some kind of system command to take care of that for me? Sorry, total newbie! – Mohamed Hafez Feb 27 '13 at 16:46
-
1Search on how your system handles booting (that is quite variable, simplest alternative are latest Linux with [systemd](http://www.freedesktop.org/wiki/Software/systemd)), and look for examples of how to write [dæmons](http://www.netzmafia.de/skripten/unix/linux-daemon-howto.html). If your system uses systemd, note that it takes over many chores in dæmon writing. – vonbrand Feb 27 '13 at 16:51
1 Answers
1
Found the answer I was looking for: use start-stop-daemon
to start and stop the daemon, and all the pidfile management, not restarting if its already running, and killing the daemon if it doesn't die on its own after sending it TERM, etc, will be taken care of according to the parameters you pass.
![](../../users/profiles/162020.webp)
Mohamed Hafez
- 151
- 8