From: Sebastian Harl Date: Thu, 3 Mar 2011 14:05:17 +0000 (+0100) Subject: *.{default,init}: Added support for default files. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=29d54df8aa3ce341280090d4288f4c54a05efcd7;p=pkg-nagixsc.git *.{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. --- 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