purge /var/run/*pid ?

George Georgalis george at galis.org
Wed Jun 22 09:22:02 PDT 2005

On Tue, Jun 21, 2005 at 01:58:39AM -0700, Matthew Dillon wrote:
>:in that case maybe /var/run/*.pid files should be purged at end of
>:shutdown or start of boot? or maybe all rc scripts should trap SIGTERM
>:(and other "terminate process" signals?) to remove their own pid file
>:on exit? Thoughts?
>:// George
>    I would say that we should probably remove (or try to remove) 
>    /var/run/*.pid files on boot, if you would like to have a go at
>    modifying the scripts.  It could be a little tricky since some demons
>    might be started before /var is mounted, and there's no point removing
>    the pid files until /var is mounted (and also read-write).  We definitely
>    do not want the startup to fail by virtue of trying to remove .pid files
>    from a read-only /var.

Looks like it's already done, thank to Simon for pointing it out.

On Tue, Jun 21, 2005 at 11:36:18AM +0200, Simon 'corecode' Schubert wrote:

Below is a patch for src/share/man/man5/rc.conf.5 and some added
comments to src/etc/rc.d/cleanvar, since its operation may not be
entirely clear.

Various circumstances prevent me from testing these out, but I expect
they are okay. ;-)

// George

--- rc.conf.5.orig	2005-06-22 11:57:50.000000000 -0400
+++ rc.conf.5	2005-06-22 11:56:49.000000000 -0400
@@ -2236,6 +2236,18 @@
 If set to
 .Dq Li YES ,
 load System V IPC primitives at boot time.
+.\" ----- cleanvar_enable setting--------------------------------
+.It Va cleanvar_enable
+.Pq Vt bool
+Set to
+.Dq Li YES
+to have
+.Pa /var/run ,
+.Pa /var/spool/lock
+.Pa /var/spool/uucp/.Temp/*
+cleaned at startup.
+.\" ----- clear_tmp_enable setting-------------------------------
 .It Va clear_tmp_enable
 .Pq Vt bool
 Set to
@@ -2243,6 +2255,7 @@
 to have
 .Pa /tmp
 cleaned at startup.
+.\" ----- ldconfig_paths setting --------------------------------
 .It Va ldconfig_paths
 .Pq Vt str
 Set to the list of shared library paths to use with
@@ -2250,6 +2263,7 @@
 .Pa /usr/lib
 will always be added first, so it need not appear in this list.
+.\" ----- ldconfig_paths_aout setting ---------------------------
 .It Va ldconfig_paths_aout
 .Pq Vt str
 Set to the list of shared library paths to use with

--- cleanvar.orig	2005-06-22 12:02:45.000000000 -0400
+++ cleanvar	2005-06-22 12:03:27.000000000 -0400
@@ -12,6 +12,8 @@
 dummy_rc_command "$1"
+# use recursion and shell test, because /usr/bin/find is not yet mounted
 	local dir file
@@ -42,6 +44,8 @@
 [ "$1" != "reload" ] && rm -f /var/run/clean_var /var/spool/lock/clean_var
+# purge /var/run /var/spool/lock and /var/spool/uucp/.Temp/*
 if [ -d /var/run -a ! -f /var/run/clean_var ]; then
 	purgedir /var/run
 	# And an initial utmp file

George Georgalis, systems architect, administrator Linux BSD IXOYE
http://galis.org/george/ cell:646-331-2027 mailto:george at xxxxxxxxx

More information about the Bugs mailing list