The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.

Things look quiet here. But I've been doing a lot of blogging at because I prefer WordPress now. Not all my posts there are FreeBSD related. I am in the midst of migrating The FreeBSD Diary over to WordPress (and you can read about that here). Once the migration is completed, I'll move the FreeBSD posts into the new FreeBSD Diary website.

sending a HUP to a program (kill) 10 January 1999
Need more help on this topic? Click here
This article has no comments
Show me similar articles
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 kill.

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 process ID.

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:

ndc reload
Need more help on this topic? Click here
This article has no comments
Show me similar articles