Added startup script
authorDaniel Kouřil <kouril@ics.muni.cz>
Wed, 13 Oct 2004 09:15:36 +0000 (09:15 +0000)
committerDaniel Kouřil <kouril@ics.muni.cz>
Wed, 13 Oct 2004 09:15:36 +0000 (09:15 +0000)
org.glite.security.proxyrenewal/config/startup [new file with mode: 0755]

diff --git a/org.glite.security.proxyrenewal/config/startup b/org.glite.security.proxyrenewal/config/startup
new file mode 100755 (executable)
index 0000000..a71cca6
--- /dev/null
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+GLITE_LOCATION=/opt/glite
+GLITE_USER=glite
+GLITE_LOCATION_VAR=/opt/glite/var
+
+PROXY_REPOSITORY="$GLITE_LOCATION_VAR/spool/glite-renewd"
+
+[ -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"] X509_USER_CERT="$GLITE_HOST_CERT"
+       [ -n "$GLITE_HOST_KEY" ] X509_USER_KEY="$GLITE_HOST_KEY"
+
+       echo -n Starting ProxyRenewal Daemon: glite-proxy-renewd ...
+
+       if [ ! -d "$PROXY_REPOSITORY" ]; then
+               mkdir -p $PROXY_REPOSITORY || exit 1
+               chown $GLITE_USER $PROXY_REPOSITORY
+               chmod 0700 $PROXY_REPOSITORY
+       fi
+       
+       su $GLITE_USER -c "$GLITE_LOCATION/bin/glite-proxy-renewd" \
+               -r $PROXY_REPOSITORY && echo " done"
+}
+
+stop()
+{
+       echo -n "Stopping ProxyRenewal Daemon: glite-proxy-renewd ..."
+       PIDS=`ps -C glite-proxy-renewd -o pid --no-heading`
+       if [ -z "$PIDS" ]; then
+               echo " no process glite-proxy-renewd running"
+               exit 1
+       else
+               kill $PIDS && echo " done"
+       fi
+}
+
+status()
+{
+       PIDS=`ps -C glite-proxy-renewd -o pid --no-heading`
+       if ps p $PIDS >/dev/null 2>&1; then
+               echo glite-proxy-renewd running \($PIDS\)
+               return 0
+       fi
+       
+       echo glite-proxy-renewd not running
+       return 1
+}
+
+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