Title: [opsview] [10185] Tidy up bash script formatting
Revision
10185
Author
dferguson
Date
2012-09-27 10:33:41 +0100 (Thu, 27 Sep 2012)

Log Message

Tidy up bash script formatting

Modified Paths


Modified: trunk/opsview-core/bin/rc.opsview-agent
===================================================================
--- trunk/opsview-core/bin/rc.opsview-agent	2012-09-26 16:48:05 UTC (rev 10184)
+++ trunk/opsview-core/bin/rc.opsview-agent	2012-09-27 09:33:41 UTC (rev 10185)
@@ -2,7 +2,7 @@
 #
 #
 # AUTHORS:
-#	Copyright (C) 2003-2012 Opsview Limited. All rights reserved
+#  Copyright (C) 2003-2012 Opsview Limited. All rights reserved
 #
 #    This file is part of Opsview
 #
@@ -41,15 +41,15 @@
 id | grep "uid=0(" >/dev/null
 if [ $? = "0" ] ; then
   case "$0" in
-		/*) cmd="$0" ;;
-		*) cmd=`which $0`
-		case "$cmd" in
-			/*) ;;
-			*) cmd="$PWD/$cmd";;
-		esac
-	;;
-	esac
-	exec su - nagios -c "$cmd $@"
+    /*) cmd="$0" ;;
+    *) cmd=`which $0`
+    case "$cmd" in
+      /*) ;;
+      *) cmd="$PWD/$cmd";;
+    esac
+  ;;
+  esac
+  exec su - nagios -c "$cmd $@"
 fi
 
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@@ -70,82 +70,82 @@
 
 getpid()
 {
-    if [ -f $PIDFILE ]; then
-        cat $PIDFILE
-    fi
+  if [ -f $PIDFILE ]; then
+    cat $PIDFILE
+  fi
 }
 
 status()
 {
-	PID=`getpid`
-	if [ "x$PID" != "x" ]; then
-        if kill -0 $PID 2>/dev/null; then
-            echo "NRPE is running as process $PID"
-            return 0
-        fi
+  PID=`getpid`
+  if [ "x$PID" != "x" ]; then
+    if kill -0 $PID 2>/dev/null; then
+      echo "NRPE is running as process $PID"
+      return 0
     fi
+  fi
 
-    echo "NRPE is not running"
-    return 1
+  echo "NRPE is not running"
+  return 1
 }
 
 killproc_nrpe()
 {
-	PID=`getpid`
-	if [ "x$PID" != "x" ]; then
-        kill -0 $PID 2>/dev/null && kill $2 $PID
-    fi
+  PID=`getpid`
+  if [ "x$PID" != "x" ]; then
+    kill -0 $PID 2>/dev/null && kill $2 $PID
+  fi
 }
 
 test -x $DAEMON || exit 0
 
 case "$1" in
-	status)
-		status ; exit $?
-	;;
+  status)
+    status ; exit $?
+  ;;
 
   start)
-		if [ ! -f $CONFIG ]; then
-			echo "No nrpe.cfg - exiting"
-			exit 1
-		fi
+    if [ ! -f $CONFIG ]; then
+      echo "No nrpe.cfg - exiting"
+      exit 1
+    fi
 
-        # test to see if the pid file can be created
-        touch -a $PIDFILE 1>/dev/null 2>&1
-        if [ $? -ne 0 ]; then
-            echo "Cannot write to $PIDFILE - exiting"
-            exit 1
-        fi
-        # if touch created an remove empty file, remove it
-        test ! -s $PIDFILE && rm -f $PIDFILE
+    # test to see if the pid file can be created
+    touch -a $PIDFILE 1>/dev/null 2>&1
+    if [ $? -ne 0 ]; then
+      echo "Cannot write to $PIDFILE - exiting"
+      exit 1
+    fi
+    # if touch created an remove empty file, remove it
+    test ! -s $PIDFILE && rm -f $PIDFILE
 
-		status nrpe > /dev/null && die "NRPE is already running"
-		
-		$DAEMON -c $CONFIG -d
+    status nrpe > /dev/null && die "NRPE is already running"
+    
+    $DAEMON -c $CONFIG -d
 
-		echo "NRPE started"
-	;;
+    echo "NRPE started"
+  ;;
 
   stop)
-		if status nrpe >/dev/null ; then
-			killproc_nrpe
-			status nrpe >/dev/null || echo "NRPE stopped"
-		else
-			echo "NRPE is not running"
-		fi
+    if status nrpe >/dev/null ; then
+      killproc_nrpe
+      status nrpe >/dev/null || echo "NRPE stopped"
+    else
+      echo "NRPE is not running"
+    fi
 
-	;;
+  ;;
 
   restart)
-		$0 stop
-		sleep 1
-		$0 start
-	;;
+    $0 stop
+    sleep 1
+    $0 start
+  ;;
 
   *)
-		echo "Usage: $N {start|stop|restart|status}" 
-		exit 1
-	;;
+    echo "Usage: $N {start|stop|restart|status}" 
+    exit 1
+  ;;
 esac
 
 exit 0

_______________________________________________
Opsview-checkins mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to