From 29d54df8aa3ce341280090d4288f4c54a05efcd7 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Thu, 3 Mar 2011 15:05:17 +0100 Subject: [PATCH] *.{default,init}: Added support for default files. These files may be used to enable/disable the daemon and specify command line arguments to be passed to the daemon. --- debian/nagixsc.nagixsc_conf2http.default | 9 +++++++++ debian/nagixsc.nagixsc_conf2http.init | 12 ++++++++++-- debian/nagixsc.nagixsc_http2nagios.default | 9 +++++++++ debian/nagixsc.nagixsc_http2nagios.init | 12 ++++++++++-- 4 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 debian/nagixsc.nagixsc_conf2http.default create mode 100644 debian/nagixsc.nagixsc_http2nagios.default diff --git a/debian/nagixsc.nagixsc_conf2http.default b/debian/nagixsc.nagixsc_conf2http.default new file mode 100644 index 0000000..0c03b46 --- /dev/null +++ b/debian/nagixsc.nagixsc_conf2http.default @@ -0,0 +1,9 @@ +# Default settings for Nag(ix)SC's nagixsc_conf2http daemon. + +# Should nagixsc_conf2http be started? ("yes" to enable) +RUN="no" + +# Command line arguments that are passed to the daemon. +# ('--daemon' is added automatically) +DAEMON_ARGS="-c /etc/nagixsc/conf2http.cfg" + diff --git a/debian/nagixsc.nagixsc_conf2http.init b/debian/nagixsc.nagixsc_conf2http.init index 29d5ad4..7f166b0 100755 --- a/debian/nagixsc.nagixsc_conf2http.init +++ b/debian/nagixsc.nagixsc_conf2http.init @@ -17,7 +17,7 @@ DESC="Nag(IX)SC Conf2HTTP" NAME=nagixsc_conf2http DAEMONPATH=/usr/sbin DAEMON=$DAEMONPATH/$NAME -DAEMON_ARGS="-c /etc/nagixsc/conf2http.cfg --daemon" +DAEMON_ARGS="-c /etc/nagixsc/conf2http.cfg" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME @@ -25,7 +25,7 @@ SCRIPTNAME=/etc/init.d/$NAME [ -x "$DAEMON" ] || exit 0 # Read configuration variable file if it is present -# [ -r /etc/default/$NAME ] && . /etc/default/$NAME +[ -r /etc/default/$NAME ] && . /etc/default/$NAME # Load the VERBOSE setting and other rcS variables [ -f /etc/default/rcS ] && . /etc/default/rcS @@ -34,6 +34,14 @@ SCRIPTNAME=/etc/init.d/$NAME # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions +# Check if RUN is set to "yes". +if [ "x$RUN" != "xyes" ] ; then + echo "$NAME has been disabled in /etc/default/$NAME." + exit 0 +fi + +DAEMON_ARGS="$DAEMON_ARGS --daemon" + is_running() { [ -f "$PIDFILE" ] || return 1 diff --git a/debian/nagixsc.nagixsc_http2nagios.default b/debian/nagixsc.nagixsc_http2nagios.default new file mode 100644 index 0000000..66ecc7e --- /dev/null +++ b/debian/nagixsc.nagixsc_http2nagios.default @@ -0,0 +1,9 @@ +# Default settings for Nag(ix)SC's nagixsc_http2nagios daemon. + +# Should nagixsc_http2nagios be started? ("yes" to enable) +RUN="no" + +# Command line arguments that are passed to the daemon. +# ('--daemon' is added automatically) +DAEMON_ARGS="-c /etc/nagixsc/http2nagios.cfg" + diff --git a/debian/nagixsc.nagixsc_http2nagios.init b/debian/nagixsc.nagixsc_http2nagios.init index ee21ca1..7898122 100755 --- a/debian/nagixsc.nagixsc_http2nagios.init +++ b/debian/nagixsc.nagixsc_http2nagios.init @@ -17,7 +17,7 @@ DESC="Nag(IX)SC HTTP2Nagios" NAME=nagixsc_http2nagios DAEMONPATH=/usr/sbin DAEMON=$DAEMONPATH/$NAME -DAEMON_ARGS="-c /etc/nagixsc/http2nagios.cfg --daemon" +DAEMON_ARGS="-c /etc/nagixsc/http2nagios.cfg" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME @@ -25,7 +25,7 @@ SCRIPTNAME=/etc/init.d/$NAME [ -x "$DAEMON" ] || exit 0 # Read configuration variable file if it is present -# [ -r /etc/default/$NAME ] && . /etc/default/$NAME +[ -r /etc/default/$NAME ] && . /etc/default/$NAME # Load the VERBOSE setting and other rcS variables [ -f /etc/default/rcS ] && . /etc/default/rcS @@ -34,6 +34,14 @@ SCRIPTNAME=/etc/init.d/$NAME # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions +# Check if RUN is set to "yes". +if [ "x$RUN" != "xyes" ] ; then + echo "$NAME has been disabled in /etc/default/$NAME." + exit 0 +fi + +DAEMON_ARGS="$DAEMON_ARGS --daemon" + is_running() { [ -f "$PIDFILE" ] || return 1 -- 2.30.2