I usually kill a process with
But I can't sure this command terminates the process gracefully. Does this command graceful termination? If it's not, how can I kill a process with its name gracefully?
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
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
If that do not work, you can try
On BSD-like and other distros, you will often have scripts in /etc/rc.d/ that typically manages starting, restarting and stopping daemons in your system. To stop a daemon you would either call the scripts with the absolute path e.g.:
or use the command:
I highly recommend to try out this script for showing your systems started and stopped daemons: