diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 0000000..6c118fc --- /dev/null +++ b/debian/README.Debian @@ -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 Wed, 8 Nov 2006 22:44:24 +0100 diff --git a/debian/changelog b/debian/changelog index 8b8ae53..4ca7517 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 - -- Sat, 4 Nov 2006 21:38:44 +0100 + -- Jan Wagner Sat, 4 Nov 2006 21:38:44 +0100 ps-watcher (1.06-1) unstable; urgency=low diff --git a/debian/default b/debian/default index 5facb1a..c68a508 100644 --- a/debian/default +++ b/debian/default @@ -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" diff --git a/debian/init.d b/debian/init.d index bccc624..e169955 100644 --- a/debian/init.d +++ b/debian/init.d @@ -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." ;; *)