#!/bin/sh # # SysV-style boot script for MyProxy # # chkconfig: 345 99 06 # description: MyProxy online credential repository # Set GLOBUS_LOCATION as appropriate for your installation. envfile="/etc/esg.env" [ -e "${envfile}" ] && eval $(grep GLOBUS_LOCATION /etc/esg.env) GLOBUS_LOCATION=${GLOBUS_LOCATION:-"/usr/local/globus"} export GLOBUS_LOCATION if [ -z $GLOBUS_LOCATION ]; then echo "GLOBUS_LOCATION is not set." echo "Please edit $0 to set GLOBUS_LOCATION." exit 1 fi . ${GLOBUS_LOCATION}/libexec/globus-script-initializer . ${libexecdir}/globus-sh-tools.sh MYPROXY=${GLOBUS_LOCATION}/sbin/myproxy-server PID_FILE=${localstatedir}/myproxy.pid # Optional server configuration arguments follow. # Uncomment and modify to change default settings. #LISTEN="-l myserver.mydomain.com" #PORT="-p 2119" #default 7512 #CONFIG="-c ${GLOBUS_LOCATION}/etc/myproxy-server.config" #STORE="-s ${GLOBUS_LOCATION}/var/myproxy" #VERBOSE="-verbose" # By default, the myproxy-server uses /etc/grid-security/hostcert.pem # and /etc/grid-security/hostkey.pem. Uncomment and modify the # following lines to configure the myproxy-server to find its # certificate and key in alternate locations. # X509_USER_CERT="/etc/grid-security/hostcert-myproxy.pem" # X509_USER_KEY="/etc/grid-security/hostkey-myproxy.pem" # export X509_USER_CERT X509_USER_KEY do_start() { if [ ! -x $MYPROXY ]; then echo "$MYPROXY is not executable. Skipping MyProxy startup." exit 1 fi if [ ! -d $localstatedir ]; then mkdir -p $localstatedir fi echo -n "Starting up MyProxy server... " $MYPROXY $LISTEN $PORT $CONFIG $STORE $VERBOSE -P $PID_FILE if [ $? -eq 0 ]; then echo "done." else echo "Failed to start MyProxy server!" exit 1 fi } do_stop() { echo -n "Stopping the MyProxy server... " pid=`cat $PID_FILE` kill -TERM $pid rm -f $PID_FILE echo "done." } do_reconfig() { echo -n "Reconfiguring the MyProxy server... " pid=`cat $PID_FILE` kill -HUP $pid echo "done." } case "$1" in start) if [ ! -f $PID_FILE ]; then do_start else pid=`cat $PID_FILE` psout=`ps -A | grep $pid | grep -v grep | awk "{if (\\\$1 == $pid) print}"` if [ "x$psout" = "x" ]; then echo "Found stale myproxy-server pid file... removing it." rm -f $PID_FILE do_start else echo "MyProxy server is already running!" fi fi ;; stop) if [ -f $PID_FILE ] ; then do_stop else echo "The server's pid file does not exist! Are you sure the server is running?" fi ;; reconfig) if [ -f $PID_FILE ] ; then do_reconfig else echo "The server's pid file does not exist! Are you sure the server is running?" fi ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 (start|stop|restart)" exit 1 esac exit 0