I am surprised it took me this long to work this out but the init script for apcupsd on my Proxmox VE server, which runs Debian Lenny, is broken. Two things it does wrong, 1) It does not create a pid file when it starts which is not terrible, but the stop procedure relies on their being a pid to stop it and gives up if there is not one. And 2) it does not pass the default /etc/apcupsd/apcupsd.conf file as the -f argument. So any changes you make to it are ignored in the running daemon. Add to that some other little scripting best practices are not followed, I have edited it and here it is. All working for me. Any feedback welcome:
#!/bin/sh ### BEGIN INIT INFO # Provides: apcupsd # Required-Start: $syslog # Required-Stop: $syslog # Should-Start: $local_fs # Should-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Starts apcupsd daemon # Description: apcupsd provides UPS power management for APC products. ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/sbin/apcupsd CONFIG=/etc/default/apcupsd NAME=apcupsd DESC="UPS power management" PID=/var/run/apcupsd.pid test -x $DAEMON || exit 0 test -e $CONFIG || exit 0 set -e . $CONFIG if [ $ISCONFIGURED = no ] then echo "Please check your configuration ISCONFIGURED in /etc/default/apcupsd" exit 0 fi case "$1" in start) echo -n "Starting $DESC: " rm -f /etc/apcupsd/powerfail if [ "$(pidof apcupsd)" == "" ] then start-stop-daemon --start --quiet --make-pidfile --pidfile $PID --exec $DAEMON -- -f /etc/apcupsd/apcupsd.conf echo "$NAME." else echo "" echo "A copy of the daemon is still running. If you just stopped it," echo "please wait about 5 seconds for it to shut down." exit 0 fi ;; stop) echo -n "Stopping $DESC: " start-stop-daemon --stop --oknodo --pidfile $PID|| echo "Not Running." rm -f $PID echo "$NAME." ;; restart|force-reload) $0 stop sleep 10 $0 start ;; status) $APCACCESS status ;; *) echo "Usage: $0 {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0