Pidfile is not generated when running ZNC als system daemon on Debian #399

Closed
opened 2026-10-05 04:18:18 +02:00 by adam · 3 comments
Owner

Just installed ZNC on Raspbian/Debian and followed the instructions to set up ZNC as system daemon on:
http://wiki.znc.in/Running_ZNC_as_a_system_daemon#Debian-based_machines
And set up the file in /etc.initrd.
But asking for the status of the service always failed.

Turned out that the pidfile was never written by ZNC. Tried to generate it with the --make-pidfile option of the start-stop-daemon, but the written pid was not the correct one.

For now this is my fix in the init.d script, maybe it helps someone.

--- znc.orig    2014-10-03 23:55:29.605214182 +0200
+++ znc 2014-10-03 23:56:50.242064196 +0200
@@ -12,7 +12,7 @@
 PATH=/sbin:/usr/sbin:/bin:/usr/bin
 DESC="ZNC daemon"
 NAME=znc
-DAEMON=/usr/bin/$NAME
+DAEMON=/usr/local/bin/$NAME
 DATADIR=/var/lib/znc
 DAEMON_ARGS="--datadir=$DATADIR"
 PIDDIR=/var/run/znc
@@ -51,6 +51,9 @@
        chown $USER:$GROUP $PIDDIR
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test --chuid $USER > /dev/null || return 1
        start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --chuid $USER -- $DAEMON_ARGS > /dev/null || return 2
+       # pidfile is not generated and --make-pidfile writes the wrong pid (-1) 
+       # create correct pidfile with `pidof`
+       pidof "${NAME}" > ${PIDFILE} || return 3
 }

 #
Just installed ZNC on Raspbian/Debian and followed the instructions to set up ZNC as system daemon on: http://wiki.znc.in/Running_ZNC_as_a_system_daemon#Debian-based_machines And set up the file in /etc.initrd. But asking for the status of the service always failed. Turned out that the pidfile was never written by ZNC. Tried to generate it with the --make-pidfile option of the start-stop-daemon, but the written pid was not the correct one. For now this is my fix in the init.d script, maybe it helps someone. ``` --- znc.orig 2014-10-03 23:55:29.605214182 +0200 +++ znc 2014-10-03 23:56:50.242064196 +0200 @@ -12,7 +12,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="ZNC daemon" NAME=znc -DAEMON=/usr/bin/$NAME +DAEMON=/usr/local/bin/$NAME DATADIR=/var/lib/znc DAEMON_ARGS="--datadir=$DATADIR" PIDDIR=/var/run/znc @@ -51,6 +51,9 @@ chown $USER:$GROUP $PIDDIR start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test --chuid $USER > /dev/null || return 1 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --chuid $USER -- $DAEMON_ARGS > /dev/null || return 2 + # pidfile is not generated and --make-pidfile writes the wrong pid (-1) + # create correct pidfile with `pidof` + pidof "${NAME}" > ${PIDFILE} || return 3 } # ``` <!-- github-sync-id:44853912 -->
adam closed this issue 2026-10-05 04:18:18 +02:00
Author
Owner

Adding PidFile = /var/run/znc/znc.pid to your znc.conf will fix this.

Adding `PidFile = /var/run/znc/znc.pid` to your znc.conf will fix this. <!-- github-comment-id:57870005 -->
Author
Owner

Thanks, this works.

Thanks, this works. <!-- github-comment-id:58762842 -->
Author
Owner

Where is the option to enable pidfile in webadmin and controlpanel?

Where is the option to enable pidfile in webadmin and controlpanel? <!-- github-comment-id:58764149 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/znc#399