]> granicus.if.org Git - pdns/commitdiff
Rec: create socket-dir from init-script
authorPieter Lexis <pieter.lexis@powerdns.com>
Thu, 22 Jun 2017 09:51:08 +0000 (11:51 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Thu, 22 Jun 2017 09:56:16 +0000 (11:56 +0200)
Closes #5439

build-scripts/build-recursor-rpm
build-scripts/debian-recursor/pdns-recursor.init

index e05f3bd0cd0419470cc80fa8d551587ddaa1db5e..960ec6ceb7165039c60d6dfeda270623ab62c191 100755 (executable)
@@ -64,6 +64,10 @@ if [ -f /etc/redhat-release ]; then
 
 RETVAL=0
 
+PIDDIR=\$(awk -F= '/^socket-dir=/ {print \$2}' /etc/powerdns/recursor.conf)
+if [ -z "\$PIDDIR" ]; then PIDDIR=/var/run; fi
+mkdir -p "\$PIDDIR"
+
 start() {
        echo -n \$"Starting pdns-recursor: "
        daemon /usr/sbin/pdns_recursor --daemon 2>/dev/null
@@ -76,7 +80,7 @@ stop() {
        echo -n \$"Stopping pdns-recursor: "
        killproc pdns_recursor
        echo
-       [ \$RETVAL -eq 0 ] && rm -f /var/lock/subsys/pdns-recursor && rm -f /var/run/pdns_recursor.controlsocket
+       [ \$RETVAL -eq 0 ] && rm -f /var/lock/subsys/pdns-recursor && rm -f \$PIDDIR/pdns_recursor.controlsocket
 }
 
 restart() {
index 5ab22c20118320b81c43b8d37fafc8327fb04c3b..4ab03837648efe177fdbc3b95ec16baf09a0ee0e 100644 (file)
@@ -28,6 +28,7 @@ DAEMON=/usr/sbin/$NAME
 # or fall back to the default /var/run if not specified there.
 PIDDIR=$(awk -F= '/^socket-dir=/ {print $2}' /etc/powerdns/recursor.conf)
 if [ -z "$PIDDIR" ]; then PIDDIR=/var/run; fi
+mkdir -p "$PIDDIR"
 PIDFILE=$PIDDIR/$NAME.pid
 
 # Gracefully exit if the package has been removed.