[Pkg-sysvinit-devel] Writing a pid file early during boot
Jurij Smakov
jurij at wooyd.org
Mon Dec 11 16:49:52 CET 2006
[Please CC the replies to me, I'm not on this list]
Hello sysvinit maintainers,
I maintain a daemon, which may be started in two different ways: on
loading of a kernel module (via a modprobe hook) and in a usual way by
init script (during boot). The problem is that when udev triggers the
loading of the module early in the boot process (in
/etc/rcS.d/S03udev), the filesystem may still be mounted read-only, so
the daemon will fail to write its pid file and fail. Even if the
filesystem is writeable, starting the daemon is not good, because its
pid file (stored in a subdir of /var/run) will later get removed by
S36mountall-bootclean.sh, resulting in the start of duplicate daemons
(bug #401558).
So, to resolve the problem I need some indicator, which would allow me
to tell reliably whether the S36mountall-bootclean.sh has been run
already. Then my init script could check for that condition when
invoked by modprobe, and defer the starting the daemon to a later
time, if /var/run has not been cleaned yet. I thought I can manage to
do that by checking the status of some flag file in /lib/init/rw,
touched only by the init script's, which runs after
S36mountall-bootclean.sh, 'start' target. That works pretty well,
except that it turned out that the version of the initscripts
currently in testing does not support the creation of /lib/init/rw
yet. I'm not sure whether the new version will be able to propagate to
etch in time, especially with the freeze announced today. I'd
appreciate any advice on alternative solutions to the problem. Another
idea I had is to put the pid file in /lib/init/rw, but that would
probably be an FHS violation.
Best regards,
--
Jurij Smakov jurij at wooyd.org
Key: http://www.wooyd.org/pgpkey/ KeyID: C99E03CC
More information about the Pkg-sysvinit-devel
mailing list