--- arcgis/server/framework/runtime/xvfb/init_Xvfb.sh 2012-04-26 12:18:35.000000000 -0400 +++ arcgis/server/framework/runtime/xvfb/init_Xvfb.sh 2013-05-21 11:35:49.438794247 -0400 @@ -7,6 +7,16 @@ XVFBPMIN=600 XVFBPMAX=619 +if [ -z "$XVFBLOG" ]; then + XVFBLOG="${XVFBHOME}/xvfb_err.log"; export XVFBLOG +fi +if [ -z "$XVFBPID" ]; then + XVFBPID="${XVFBHOME}/xvfb.pid"; export XVFBPID +fi +if [ -z "$XVFBPORTF" ]; then + XVFBPORTF="${XVFBHOME}/xvfb.port"; export XVFBPORTF +fi + export XVFBHOME XVFBPMIN XVFBPMAX #introduced the if condition below for ArcGIS Server configuration logging @@ -15,8 +25,6 @@ { if [ -n "$XVFBDEBUG" ]; then echo "$1" - else - echo "" fi } @@ -64,7 +72,8 @@ XVFBBIN="${XVFBHOME}/RHEL/Xvfb" fi fi - ${XVFBBIN} :${XVFBPORT} -screen 0 1280x1024x24 ${ESRIFontPath} -ac 2> ${XVFBHOME}/xvfb_err.log & + ${XVFBBIN} :${XVFBPORT} -screen 0 1280x1024x24 ${ESRIFontPath} -ac 2> ${XVFBLOG} & + XVFBBINPID=$! # Pause a moment and then see if it started up ok. sleep 1 @@ -74,6 +83,7 @@ echo "ERROR: Unable to start Xvfb on port $XVFBPORT." else # Xvfb started ok. + echo $XVFBBINPID > ${XVFBPID} break fi fi @@ -91,7 +101,7 @@ if [ "x${XVFBPORT}x" != "xx" ] then #Store the port value for use with AGS system port listing utility - echo $XVFBPORT > ${XVFBHOME}/xvfb.port + echo $XVFBPORT > ${XVFBPORTF} fi } @@ -99,25 +109,37 @@ { if [ "x$DISABLE_ARCGISSERVER_VDS" = "x" ] then - XVFBPORT=$XVFBPMIN;export XVFBPORT - - while [ $XVFBPORT -le $XVFBPMAX ] - do - process_list=`ps -u $LOGNAME -o pid,cmd | grep Xvfb | grep "${XVFBPORT} -screen" | grep -v grep | xargs | awk '{print $1}'` - if [ "$process_list" != "" ] - then - echo_dbg "Stopping Xvfb on port $XVFBPORT" - kill -TERM $process_list - + if [ -r "${XVFBPID}" ]; then + kill -TERM `cat ${XVFBPID}` + rm -f "${XVFBPID}" + if [ -r "${XVFBPORT}" ]; then + XVFBPORT=`cat ${XVFBPORTF}`; export XVFBPORT rm -f /tmp/.X11-unix/X$XVFBPORT >/dev/null 2>&1 rm -f /tmp/.X11-pipe/X$XVFBPORT >/dev/null 2>&1 rm -f /tmp/.X$XVFBPORT-lock >/dev/null 2>&1 - if [ -f ${XVFBHOME}/xvfb.port ] + rm -f "${XVFBPORTF}" + fi + else + XVFBPORT=$XVFBPMIN; export XVFBPORT + + while [ $XVFBPORT -le $XVFBPMAX ] + do + process_list=`ps -u $LOGNAME -o pid,cmd | grep Xvfb | grep "${XVFBPORT} -screen" | grep -v grep | xargs | awk '{print $1}'` + if [ "$process_list" != "" ] then - rm -f ${XVFBHOME}/xvfb.port + echo_dbg "Stopping Xvfb on port $XVFBPORT" + kill -TERM $process_list + + rm -f /tmp/.X11-unix/X$XVFBPORT >/dev/null 2>&1 + rm -f /tmp/.X11-pipe/X$XVFBPORT >/dev/null 2>&1 + rm -f /tmp/.X$XVFBPORT-lock >/dev/null 2>&1 + if [ -f ${XVFBPORTF} ] + then + rm -f ${XVFBPORTF} + fi fi - fi - XVFBPORT=`expr $XVFBPORT + 1`;export XVFBPORT - done + XVFBPORT=`expr $XVFBPORT + 1`;export XVFBPORT + done + fi fi }