On Sun, Oct 03, 2004 at 10:22:17PM -0700, Jamie Zawinski wrote: > Maybe this is a dumb question, but what's the point of pid files, > anyway? Are they used by anything other than the init.d scripts? > Why not just use /sbin/pidof instead? pidof matches strings in /proc/*/cmdline. The match may be imperfect and could catch other processes (think user-created processes whose argv[0] names are set to match a system daemon). pidof may also return pids of child processes of the daemon. This can be a problem if you are trying to restart a daemon such as sshd--you don't want to kill all open ssh connections, just restart the parent daemon. Using a pid file that was created by the parent daemon itself prevents these problems, as long as you can trust who has access to write the pid file.