]> Frank Brehm's Git Trees - scripts/solaris.git/commitdiff
Kommandos restart + status dazu, runfile angelegt
authorFrank Brehm <frank@brehm-online.com>
Mon, 14 Nov 2005 12:01:56 +0000 (12:01 +0000)
committerFrank Brehm <frank@brehm-online.com>
Mon, 14 Nov 2005 12:01:56 +0000 (12:01 +0000)
smc.agent

index c23442596ed20484583527c4e67022dad33de207..2d6e86fe6be1e991ac84d4d5fa198da921ac65d5 100755 (executable)
--- a/smc.agent
+++ b/smc.agent
@@ -25,6 +25,9 @@ ESTS=98
 # empty log file
 LOGFILE=/tmp/smc-agent.start.`/bin/date +%Y%m%d%H%M%S`
 
+# run file
+RUNFILE=/var/run/smc.agent.run
+
 case "$1" in
 
   'start')
@@ -74,6 +77,10 @@ case "$1" in
 
     echo
 
+    if [ $ESTS -eq 0 ] ; then
+      touch $RUNFILE
+    fi
+
     ;;
 
   'stop')
@@ -87,11 +94,40 @@ case "$1" in
       ESTS=99
     fi
 
+    if [ -f $RUNFILE ] ; then
+      rm -f $RUNFILE
+    fi
+
+    ;;
+
+  'restart')
+
+    if $0 status >/dev/null ; then
+      $0 stop && $0 start
+      ESTS=$?
+    else
+      $0 start
+      ESTS=$?
+    fi
+
+    ;;
+
+  'status')
+
+    /usr/bin/ps -ef | grep "esd - init agent" >/dev/null
+    if [ $? -eq 0 ] ; then
+      echo "Sun Management Center Agent Layer is running"
+      ESTS=0
+    else
+      echo "Sun Management Center Agent Layer is stopped"
+      ESTS=1
+    fi
+
     ;;
 
   *)
 
-    echo "Usage: $0 [start|stop]" >&2
+    echo "Usage: $0 [start|stop|restart|status]" >&2
     ESTS=100
     ;;