fix LSB init headers; add pidfile & configfile handling to debian init scripts

This commit is contained in:
marschap
2008-05-02 11:10:28 +00:00
parent 2c3d3fd60b
commit e40175b3c0
19 changed files with 108 additions and 27 deletions
+20 -4
View File
@@ -1,11 +1,12 @@
#! /bin/sh
#### BEGIN INIT INFO
### BEGIN INIT INFO
# Provides: lcdexec
# Required-Start: $syslog $local_fs $network $remote_fs
# Required-Stop: $syslog $local_fs $network $remote_fs
# Should-Start: LCDd
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Default-Stop: 0 1 6
# Short-Description: LCDproc program starter from the LCDd menu
# Description: Debian init script for lcdexec, the client to
# start programs from the LCDd menu in the LCDproc suite
@@ -19,6 +20,9 @@ NAME=${NAME:-lcdexec}
DAEMON=/usr/bin/lcdexec
DESC="LCDproc program starter"
DEFAULTS=/etc/default/$NAME
CONFIGFILE=/etc/lcdproc/$NAME.conf
PIDFILE=/var/run/$NAME.pid
OPTIONS=""
START=no
# Source defaults file; edit that file to configure this script.
@@ -26,6 +30,18 @@ if [ -e "${DEFAULTS}" ]; then
. "${DEFAULTS}"
fi
# try to get PID file name from config file
if [ -f "${CONFIGFILE:=/etc/lcdproc/$NAME.conf}" ]; then
PIDFILE=`grep -i '^[:space:]*PidFile[:space:]*=' ${CONFIGFILE} \
| head -n1 \
| cut -d= -f2- \
| sed -e 's,^[:space:]*\(.*\)[:space:]*$,\1,'`
OPTIONS="${OPTIONS} -c ${CONFIGFILE}"
fi
# if necessary set default PID file name
PIDFILE=${PIDFILE:-/var/run/$NAME.pid}
# If we're not to start the daemon, simply exit
if [ "${START}" != "yes" ]; then
exit 0
@@ -41,12 +57,12 @@ test -x $DAEMON || exit 5
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
start_daemon $DAEMON $OPTIONS
start_daemon -p $PIDFILE $DAEMON $OPTIONS
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
killproc $DAEMON
killproc -p $PIDFILE $DAEMON
log_end_msg $?
;;
restart|reload|force-reload)