I usually kill a process with killall
.
killall markdoc
But I am not sure if this command terminates the process gracefully.
Does this command achieve graceful termination? If it does not, how can I kill a process with its name gracefully?
killprocess
I usually kill a process with killall
.
killall markdoc
But I am not sure if this command terminates the process gracefully.
Does this command achieve graceful termination? If it does not, how can I kill a process with its name gracefully?
Best Answer
Your question is not clear, you talk about a daemon in the title, but in the body only talk about a generic process.
For a daemon there are specific means to stop it, for example in Debian you have
or
Similar syntaxes exist for other initscript standards used in other distributions/OS.
To kill a non-daemon process, supposing it is in some way out of control, you can safely use
killall
orpkill
, given that they use by default theSIGTERM
(15) signal, and any decently written application should catch and gracefully exit on receiving this signal. Take into account that these utilities could kill more that one process, if there are many with the same name.If that do not work, you can try
SIGINT
(2), thenSIGHUP
(1), and as a last resortSIGKILL
(9). This last signal cannot be catched by the application, so that it cannot perform any clean-up. For this reason it should be avoided every time you can.Both
pkill
andkillall
accept a signal parameter in the form-NAME
, as in