sending a HUP to a program (kill)
From time to time, you need to tell a program to HUP (Hang UP). This causes the
program to restart and examine its configuration files. This is especially useful if
you have changed the configuration settings. There are two commands you can use for
this: kill and killall.
kill kills a process by its process id.
After a configuration file is
modified, you can send a signal to the program to inform it that changes have been made
and that it should reread the file. This is done using the kill
command. The first thing you need is the process id of the program.
This example shows how to restart inetd after a change has been made to /etc/inetd.conf.
[root@ns:~] # ps -auwx | grep inetd root 1368 2.3 1.0 176 132 p1 R+ 12:51PM 0:00.14 grep inetd root 128 0.0 0.0 212 0 ?? IWs - 0:00.00 (inetd) [root@ns:~] # kill -HUP 128
In this example, the process id for inetd is 128. The
other process is the grep command.
For more information about the kill command, see man
killall kills a process by its name. In the above example, we could
achieve the same thing by doing:
[root@ns:~] # killall -HUP inetd
killall is much easier than then kill in that it does not require a
Notes of warning
You shouldn’t use kill or killall on Apache. See Apache – starting/stopping for more information.
Also, for named,
you should use ndc to send a HUP etc. For example, after changing your zone
files, you should do the following to reload named: