Browse Source

Create /var/run/ngircd/ when starting the daemon Closes: #507259

Matt Arnold 15 years ago
parent
commit
4f77ad5189
1 changed files with 9 additions and 1 deletions
  1. 9 1
      debian/ngircd.init

+ 9 - 1
debian/ngircd.init

@@ -36,7 +36,8 @@ NAME=ngircd
 DESC="Next generation IRC daemon"
 LOGDIR=/var/log/
 
-PIDFILE=/var/run/ngircd/$NAME.pid
+PIDDIR=/var/run/ngircd
+PIDFILE=$PIDDIR/$NAME.pid
 
 test -x $DAEMON || exit 0
 
@@ -154,6 +155,13 @@ case "$1" in
             log_end_msg 0
             exit 0
         fi
+        # If $PIDDIR doesn't exist, create it and give it proper permissions
+        # Useful if $PIDDIR is in a tmpfs
+        if [ ! -d "$PIDDIR" ]; then
+            mkdir $PIDDIR
+            chown irc:irc $PIDDIR
+            chmod 770 $PIDDIR
+        fi
         if start_server ; then
             # NOTE: Some servers might die some time after they start,
             # this code will detect this issue if STARTTIME is set