dent "@(#)S86iwsserv 1.00 02/14/2000 SMI" # # # Copyright 02/14/2000 Sun Microsystems, Inc. All Rights Reserved # # # Start/Stop iPlanet Web Server # trap 'echo "$0: Interrupted "; exit 1' INT QUIT unset ENV USAGE="Usage: `basename $0` {start | restart | stop }" BASEDIR=/opt/NSCPserver/iws PATH=/usr/sbin:/sbin:/usr/bin:${BASEDIR}:${BASEDIR}/bin LD_LIBRARY_PATH=${BASEDIR}/lib:${LD_LIBRARY_PATH} HOSTNAME=`hostname` FQNAME=`nslookup ${HOSTNAME} | grep ${HOSTNAME} | cut -c10-80 | perl -e 'while(<>){s/^\s+//;print}'` echo ${FQNAME} SERVER=https-${FQNAME} echo ${SERVER} SERVERPID=$BASEDIR/$SERVER/logs/pid export PATH export LD_LIBRARY_PATH case "$1" in 'start') # # check admin server status and start if necessary # pid=`ps -ef | grep ns-httpd | grep "$SERVER" | grep -v grep|awk '{print $2}'` if [ "$pid" != "" ]; then echo "iPlanet WS $SERVER instance is already running" else if [ -f ${SERVERPID} ]; then pid=`cat ${SERVERPID}` count=`/bin/ps -e | /bin/awk '{print $1}' | grep -c ${pid}` if [ ${count} -ge "1" ]; then echo "iPlanet WS $SERVER instance is already running" else echo "Starting iPlanet WS $SERVER instance" $BASEDIR/$SERVER/start fi else echo "Starting iPlanet WS $SERVER instance" $BASEDIR/$SERVER/start fi fi ;; 'restart') echo "Restarting iPlanet WS $SERVER instance" $BASEDIR/$SERVER/restart ;; 'stop') # # Stop The Megatron Server # if [ -f ${SERVERPID} ]; then pid=`cat ${SERVERPID}` count=`/bin/ps -e| /bin/awk '{print $1}' | grep -c ${pid}` if [ ${count} -eq "1" ]; then echo "Stopping iPlanet WS $SERVER instance" $BASEDIR/$SERVER/stop else echo "iPlanet WS $SERVER instance was not running" rm ${SERVERPID} fi else pid=`ps -ef | grep ns-httpd | grep "$SERVER" | grep -v grep|awk '{print $2}'` if [ "$pid" != "" ]; then echo "Stopping iPlanet WS $SERVER instance" $BASEDIR/$SERVER/stop else echo "iPlanet WS $SERVER instance was not running" fi fi ;; *) echo ${USAGE} exit 1 ;; esac exit 0