Startup script for glite-lb-logd and glite-lb-interlogd
authorZdeněk Salvet <salvet@ics.muni.cz>
Wed, 13 Oct 2004 12:41:21 +0000 (12:41 +0000)
committerZdeněk Salvet <salvet@ics.muni.cz>
Wed, 13 Oct 2004 12:41:21 +0000 (12:41 +0000)
org.glite.lb.logger/config/startup [new file with mode: 0755]

diff --git a/org.glite.lb.logger/config/startup b/org.glite.lb.logger/config/startup
new file mode 100755 (executable)
index 0000000..dd90481
--- /dev/null
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+GLITE_LOCATION=/opt/glite
+GLITE_USER=glite
+GLITE_LOCATION_VAR=/opt/glite/var
+
+[ -f /etc/glite.conf ] && . /etc/glite.conf
+[ -f $HOME/.glite.conf ] && . $HOME/.glite.conf
+
+[ -f $GLITE_LOCATION/etc/lb.conf ] && . $GLITE_LOCATION/etc/lb.conf
+[ -f $GLITE_LOCATION_VAR/etc/lb.conf ] && . $GLITE_LOCATION_VAR/etc/lb.conf
+
+start()
+{
+       [ -n "$GLITE_HOST_CERT" -a -n "$GLITE_HOST_KEY" ] &&
+               creds="-c $GLITE_HOST_CERT -k $GLITE_HOST_KEY"
+
+       [ -z "$creds" ] && echo $0: WARNING: No credentials specified. Using default lookup which is dangerous. >&2
+
+       [ -n "$GLITE_LB_LOGGER_PORT" ] && port="-p $GLITE_LB_LOGGER_PORT"
+
+       echo -n Starting glite-lb-logd ...
+        (cd /tmp && ls -f /tmp |fgrep ^dglogd_sock_ |xargs rm -f)
+       su $GLITE_USER -c "$GLITE_LOCATION/bin/glite-lb-logd \
+               $creds $port" && echo " done"
+
+       echo -n Starting glite-lb-interlogd ...
+       su $GLITE_USER -c "$GLITE_LOCATION/bin/glite-lb-interlogd \
+               $creds" && echo " done"
+}
+
+stop()
+{
+               echo -n Stopping glite-lb-logd ...
+               killall glite-lb-logd
+               echo " done"
+               echo -n Stopping glite-lb-interlogd ...
+               killall glite-lb-interlogd
+               echo " done"
+}
+
+status()
+{
+       if netstat -an --inet | grep "^tcp .* 0.0.0.0:${GLITE_LB_LOGGER_PORT:-9002} .*LISTEN" >/dev/null 2>&1 ;then
+       echo glite-lb-logd running
+       else
+       echo glite-lb-logd not running
+       return 1
+       fi
+       if netstat -an --unix | grep "^unix .* LISTEN.* /tmp/interlogger.sock$" >/dev/null 2>&1 ;then
+       echo glite-lb-interlogd running
+       else
+       echo glite-lb-interlogd not running
+       return 1
+       fi
+}
+
+case x$1 in
+       xstart) start;;
+       xstop)  stop;;
+       xrestart) stop; start;;
+       xstatus) status;;
+       x*)     echo usage: $0 start,stop,restart,status >&2
+               exit 1;;
+esac