NDPF VOBOX Alice Renewalscript

From PDP/Grid Wiki
Revision as of 16:34, 12 December 2007 by Davidg@nikhef.nl (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Renewal script

This script now also generates the result of the status call, and thus makes the Alice VOBOX test happier.


[root@erf root]# cat /etc/init.d/alice-box-proxyrenewal
#!/bin/sh
# chkconfig: 2345 99 01
# description: wrapper for VO box proxy renewal, but running in background

VONAME=alice
VOADMIN=sgmalice
VOGROUP=`id -gn ${VOADMIN}`
VOBOX_ROOTDIR=${VOBOX_ROOTDIR:-/opt/vobox}

getpid()
{
 ps -axo "%p:%a" | egrep "$*" | grep -v egrep | cut -d ':' -f 1
}

status()
{

PID=`getpid ${LCG_LOCATION}/sbin/vobox-renewd  ${VONAME} ${VOADMIN} ${VOBOX_ROOTDIR}`

 if [ -n "$PID" ]; then
  echo Service running in pid: $PID
  ps u -C vobox-renewd | grep ${VONAME}
 elif [ -f $PID_FILE ]; then
    echo "Service not running but stale pid file present."
    exit 1
 else
    echo "Service not running"
 fi

}

case "$1" in
        status)
                status edg-wl-renewd
                RETVAL=$?
                ;;
        *)
        /etc/rc.d/init.d/alice-box-proxyrenewal.orig "$@" >> /tmp/alice-vobox-log 2>&1 &
                RETVAL=0
                ;;
esac
exit $RETVAL