aprove initscript

This commit is contained in:
Jan Wagner 2006-11-09 07:51:37 +00:00
parent 8359c5ead7
commit 6f07969451
4 changed files with 60 additions and 8 deletions

17
debian/README.Debian vendored Normal file
View file

@ -0,0 +1,17 @@
ps-watcher for Debian
---------------------
1. PROVIDE A CONFIGFILE
-----------------------
Please provide a config file, usualy /etc/ps-watcher.conf. Examples are
located in /usr/share/doc/ps-watcher/examples/.
2. AUTOMATIC STARTUP
--------------------
In order to avoid the startup of the daemon on an unconfigured machine,
automatic startup, on boot, is disabled by default. To enable it just edit the
file /etc/default/ps-watcher and set the "startup" variable to 1.
-- Jan Wagner <waja@cyconet.org> Wed, 8 Nov 2006 22:44:24 +0100

4
debian/changelog vendored
View file

@ -1,8 +1,10 @@
ps-watcher (1.06-2) unstable; urgency=low
* remove dh_strip from rules
* adjust depencies (libconfig-inifiles-perl, libsys-syslog-perl)
* modifying initscript to prevent to start without config file
-- <waja@cyconet.org> Sat, 4 Nov 2006 21:38:44 +0100
-- Jan Wagner <waja@cyconet.org> Sat, 4 Nov 2006 21:38:44 +0100
ps-watcher (1.06-1) unstable; urgency=low

11
debian/default vendored
View file

@ -2,6 +2,13 @@
# sourced by /etc/init.d/ps-watcher
# installed at /etc/default/ps-watcher by the maintainer scripts
# prevent startup without configuration file
# set the below varible to 1 in order to allow ps-watcher to start
# startup=1
# Specify your configfile here
CONFIG="/etc/ps-watcher.conf"
# Additional options that are passed to the Daemon.
# here: specify config file, daemon mode, check every 150 secs
DAEMON_OPTS="-c /etc/ps-watcher.conf --daemon --sleep 150"
# here: check every 150 secs
DAEMON_OPTS="--sleep 150"

36
debian/init.d vendored
View file

@ -30,11 +30,37 @@ fi
set -e
not_configured () {
echo "#### WARNING ####"
echo "ps-watcher won't be started/stopped unless it is configured"
if [ "$1" != "stop" ]
then
echo ""
echo "Please pease provide a configfile!"
echo "See /usr/share/doc/ps-watcher/README.Debian.gz."
fi
echo "#################"
exit 0
}
# check if ps-watcher is configured or not
if [ -f "/etc/default/pswatcher" ]
then
. /etc/default/ps-watcher
if [ "$startup" != "1" ] || [ -f $CONFIG ]
then
not_configured
fi
else
not_configured
fi
case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON -- $DAEMON_OPTS
--exec $DAEMON -- -c $CONFIG --daemon $DAEMON_OPTS
echo "$NAME."
;;
stop)
@ -45,11 +71,11 @@ case "$1" in
;;
restart|force-reload)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON
start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON
sleep 1
start-stop-daemon --start --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON -- -c $CONFIG --daemon $DAEMON_OPTS
echo "$NAME."
;;
*)