Package: tenshi
Version: 0.4-1.3
Severity: wishlist
Tags: patch
User: [EMAIL PROTECTED]
Usertag: origin-ubuntu ubuntu-patch

This bug was reported in Launchpad:
https://bugs.launchpad.net/bugs/189623

In Ubuntu /var/run is mounted as tmpfs, so directory /var/run/tenshi
does not exist when the system is rebooted. Therefore tenshi cannot
write it's pid file and fails to start. This problem was fixed for
Ubuntu with the attached patch.
Although Debian does not mount /var/run as tmpfs, this patch may still
be useful for some users or for future use.

--- /home/ncm/tenshi-init.d-old	2008-02-06 11:24:17.000000000 -0500
+++ /etc/init.d/tenshi	2008-02-06 11:41:23.000000000 -0500
@@ -14,14 +14,25 @@
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 DAEMON=/usr/sbin/tenshi
 NAME=tenshi
-PIDFILE=/var/run/tenshi/$NAME.pid
+PIDDIR=/var/run/$NAME
+PIDFILE=$PIDDIR/$NAME.pid
+DAEMONUSER=tenshi
 
 test -x $DAEMON || exit 0
 
+do_start() {
+	# make sure we have our PID directory
+	if [ ! -d $PIDDIR ]; then
+		mkdir -p $PIDDIR
+		chown $DAEMONUSER:$DAEMONUSER $PIDDIR
+	fi
+	start-stop-daemon --start -c tenshi --pidfile $PIDFILE --startas $DAEMON -- -P $PIDFILE
+}
+
 case "$1" in
   start)
 	echo -n "Starting log monitor: tenshi"
-	start-stop-daemon --start -c tenshi --pidfile $PIDFILE --startas $DAEMON -- -P $PIDFILE
+	do_start
 	echo "."
 	;;
   stop)
@@ -40,7 +51,7 @@
 	echo "."
 	sleep 1
 	echo -n "Starting log monitor: tenshi"
-	start-stop-daemon --start -c tenshi --pidfile $PIDFILE --startas $DAEMON -- -P $PIDFILE
+	do_start
 	echo "."
 	;;
   *)

Reply via email to