Anand Buddhdev wrote:
I'm testing Knot 1.3.0-rc2. One issue I've run
into is when knot exits
uncleanly. In this case, it leaves its PID file behind in
/var/lib/knot/knot.pid.
side note: PID files *must* be placed in /var/run, not /var/lib, on
systems that comply with the filesystem hierarchy standard. some
non-FHS systems (e.g., freebsd) do not even have /var/lib.
in general i would recommend using /var/run/${DAEMON}/${DAEMON}.pid for
pidfiles, creating /var/run/${DAEMON}/ if necessary, owned by the
daemon's uid/gid. then you can use the same directory for lock files,
control sockets, etc.
http://www.pathname.com/fhs/pub/fhs-2.3.html#VARRUNRUNTIMEVARIABLEDATA
/var/run : Run-time variable data
Purpose
This directory contains system information data describing the
system since it was booted. Files under this directory must be
cleared (removed or truncated as appropriate) at the beginning of
the boot process. Programs may have a subdirectory of /var/run; this
is encouraged for programs that use more than one run-time file.
[42] Process identifier (PID) files, which were originally placed in
/etc, must be placed in /var/run. The naming convention for PID
files is <program-name>.pid. For example, the crond PID file is
named /var/run/crond.pid.
http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLIBVARIABLESTATEINFORMATION
/var/lib : Variable state information
Purpose
This hierarchy holds state information pertaining to an application
or the system. State information is data that programs modify while
they run, and that pertains to one specific host. Users must never
need to modify files in /var/lib to configure a package's operation.
State information is generally used to preserve the condition of an
application (or a group of inter-related applications) between
invocations and between different instances of the same application.
State information should generally remain valid after a reboot,
should not be logging output, and should not be spooled data.
An application (or a group of inter-related applications) must use a
subdirectory of /var/lib for its data. There is one required
subdirectory, /var/lib/misc, which is intended for state files that
don't need a subdirectory; the other subdirectories should only be
present if the application in question is included in the
distribution. [38]
/var/lib/<name> is the location that must be used for all
distribution packaging support. Different distributions may use
different names, of course.
--
Robert Edmonds
edmonds(a)debian.org