Skip to content

Instantly share code, notes, and snippets.

@antaflos
Created December 5, 2011 22:40
Show Gist options
  • Save antaflos/1435737 to your computer and use it in GitHub Desktop.
Save antaflos/1435737 to your computer and use it in GitHub Desktop.
Patches to make opsview init script LSB compatible
--- /etc/init.d/opsview-web 2011-10-12 01:19:02.000000000 +0200
+++ opsview-web.new 2011-12-05 23:06:55.149909067 +0100
@@ -179,7 +179,14 @@
start) start;;
stop) stop;;
restart) restart;;
- status) status;;
+ status)
+ status
+ case "$?" in
+ 0) RETVAL=0 ;;
+ 1) RETVAL=3 ;;
+ *) RETVAL=1 ;;
+ esac
+ ;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
--- /etc/init.d/opsview 2011-10-12 01:18:29.000000000 +0200
+++ opsview.new 2011-12-05 23:30:33.139842948 +0100
@@ -301,7 +301,7 @@
test ! -f $NagiosCfg && die "No nagios.cfg - exiting"
- status $NagiosRun && die "Nagios already running"
+ status $NagiosRun && echo "Nagios already running" && exit 0
if [ $MASTER = "yes" ] ; then
perl -e 'use lib "/usr/local/nagios/lib", "/usr/local/nagios/etc", "/usr/local/nagios/perl/lib"; use Opsview::Auditlog; Opsview::Auditlog->system( "Starting Opsview" );'
@@ -369,7 +369,7 @@
exit 0
else
echo "Nagios is not running"
- exit 1
+ exit 3
fi
;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment