easy question about kill command

Dan Nelson dnelson at allantgroup.com
Fri Dec 16 08:36:38 PST 2005


In the last episode (Dec 16), Roman Gorohov.               said:
> Oliver Fromme wrote:
> 
> > roma.a.g <roma.a.g at gmail.com> wrote:
>  >> Is there anyone who can explain me, why when i say 'kill -HUP id',
>  >> and its failed to restart, kill say nothing?
> 
> > There is no way for the kill command to know what the target
> > process is going to do with the signal.  This is entirely and only
> > the business of the target process, which might chose to take the
> > default action (in the case of SIGHUP it's to terminate the
> > process), to ignore the signal alltogether, or to take some special
> > action. Some programs use SIGHUP traditionally to rotate their
> > logfiles, re-read configuration files, re-open network sockets,
> > restart themselves, or other things.  But that's entirely up to the
> > program in question, and there is no way the kill command could
> > know about it, let alone whether it was successful or not.
> 
> Thanks for your reply. My question was about standard bsd daemons,
> not about some apps with unpredictable behaviour.

It still depends on what daemon you're talking about.  syslogd, for
example, re-reads /etc/syslog.conf and reloads its logfiles on SIGHUP. 
Luckily, most base daemons are started from their own /etc/rc.d/*
scripts which know how that particular program works, so you can use
them to start/stop/restart daemons and not have to look up pids
manually.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-hackers mailing list