#!/bin/sh ## ## zopectl-srp ## ## starts, stops or restarts all srp-clients. ## ## Syntax: zopectl-srp [start|stop|restart] ## ## (c) 2006 Uli Fouquet and waeup.org ## All clients to handle... CLIENTDIRS="srp srp-ssl01" ## Where do the clients reside? CLIENTHOMES="/zope/instances/" CURR_DIR=`pwd` ## We expect at least one argument... if [ -z $1 ]; then echo "Usage: $0 [start|stop|restart|logreopen]" echo "Starts, stops or restarts all srp clients" exit fi ## We support help options... HELPLIST="help -help --help -h" for TOKEN in $HELPLIST; do if [ $1 = $TOKEN ]; then echo "Usage: $0 [start|stop|restart|logreopen]" echo "Starts, stops or restarts all srp clients" exit fi done ## We only allow root to run thos script. if [ $EUID -ne 0 ]; then echo "You must be root to execute this script." exit fi if [ -f /etc/default/zopectl-srp ]; then . /etc/default/zopectl-srp fi echo "Handling instances in $CLIENTHOMES" ## Do $1 to every single client... for DIR in $CLIENTDIRS; do echo "Handling instance: $DIR"; echo " waiting 10 secs..." sleep 10 ## Does the clienthome exist? if [ ! -d $CLIENTHOMES$DIR ]; then echo "Can't find $CLIENTHOMES$DIR." echo "Omitting this client." else ZOPECTLSCRIPT=$CLIENTHOMES$DIR/bin/zopectl ## Does the zopectl-script exist? if [ ! -x $ZOPECTLSCRIPT ]; then echo "Can't find executable $ZOPECTLSCRIPT" echo "Omitting this client" else ## Do it... echo "Doing $ZOPECTLSCRIPT $1" $ZOPECTLSCRIPT $1 fi fi done cd $CURR_DIR