[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, master, updated. debian/0.3-1-8-g0bd00da

Alexander Wirt alexander.wirt at credativ.de
Tue Feb 26 08:53:09 UTC 2013


The following commit has been merged in the master branch:
commit 41ab55724638c32acff04994b2a0cb4e6bde952a
Author: Alexander Wirt <alexander.wirt at credativ.de>
Date:   Tue Feb 26 09:49:48 2013 +0100

    Add default handling and disable nsca-ng-server on installation time

diff --git a/debian/nsca-ng-server.default b/debian/nsca-ng-server.default
new file mode 100644
index 0000000..53aaa52
--- /dev/null
+++ b/debian/nsca-ng-server.default
@@ -0,0 +1,7 @@
+# /etc/default/nsca-ng
+
+# Please read /usr/share/doc/nsca-ng-server/README.Debian for information
+# how to get nsca-ng working
+
+# start nsca-ng daemon (no/yes)
+NSCA-NG=no
diff --git a/debian/nsca-ng-server.init b/debian/nsca-ng-server.init
index 8f71eef..21317fa 100644
--- a/debian/nsca-ng-server.init
+++ b/debian/nsca-ng-server.init
@@ -35,6 +35,11 @@ CFGFILE="/etc/nsca-ng/nsca-ng.cfg"
 # Load the VERBOSE setting and other rcS variables
 . /lib/init/vars.sh
 
+if [ "$NSCA-NG" != "yes"  ]; then
+	log_warning_msg "Not starting nsca-ng - edit /etc/default/nsca-ng-server to enable it"
+	exit 0
+fi
+
 if [ -r "$CFGFILE" ]
 then
 	: ${DAEMONUSER:="$(sed -r -n "s/^[[:blank:]]*user[[:blank:]]*=[[:blank:]]*[\"']?([^\"'#[:blank:]]+).*/\1/p" "$CFGFILE")"}
@@ -58,14 +63,44 @@ then
 fi
 
 # Set the default command line arguments.
-: ${DAEMONARGS:="-P $PIDFILE -c $CFGFILE"}
+: ${DAEMONARGS:="-P $PIDFILE -c $CFGFILE -s"}
 
 DAEMONCTL="start-stop-daemon --quiet --pidfile $PIDFILE --exec $DAEMON"
 
+check_started() {
+	if status_of_proc "$DAEMON" "$DESC"
+	then
+		return 0 #is started
+	else
+		return 1 #isn't started
+	fi
+}
+
+status()
+{
+  log_action_begin_msg "checking $DAEMON"
+  if check_started; then
+    log_action_end_msg 0 "running"
+  else
+    if [ -e "$PIDFILE" ]; then
+      log_action_end_msg 1 "$DAEMON failed"
+      exit 1
+    else
+      log_action_end_msg 1 "not running"
+      exit 3
+    fi  
+  fi  
+}
+
 case $1 in
 start)
 	log_daemon_msg "Starting $DESC" "$NAME"
-	$DAEMONCTL --start -- $DAEMONARGS
+	if ! check_started
+	then
+		$DAEMONCTL --start -- $DAEMONARGS
+	else
+		log_warning_msg "already running!"
+	fi
 	log_end_msg $?
 	;;
 stop)
@@ -82,7 +117,7 @@ reload|force-reload)
 	log_end_msg $?
 	;;
 status)
-	status_of_proc "$DAEMON" "$DESC" && exit 0 || exit $?
+	status
 	;;
 *)
 	echo >&2 "Usage: $0 {start|stop|status|restart|reload|force-reload}"

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list