#!/bin/sh ################################################################# # prodllsubmit - Utility to release load leveler jobs into other # user ids # # History: 05/17/99 (Michaud) - Created for IBM SP # History: 04/14/00 (Gilbert) - Changed to pass Production # Environment variables to the # subsequent loadleveler job. # History: 09/01/01 (Gilbert) - Added timer to send a SIGUSR1 signal to # this script after 90 seconds. # If SIGUSR1 signal is received, the rsh # command is probably hung and will be killed. # ################################################################# # # Usage: prodllsubmit [userid] [script_name] # #set -x userid=$1 script_name=$2 if test $# -ne 2 then set +x echo "Usage: prodllsubmit [userid] [script_name]" echo " userid - ncosp userid" echo " script_name - full path/script name" echo "" exit set -x fi ### ###only run prodllsubmits on frost and snow for ###people who have requested it. This logic ###block should only be valid until frost/snow is operational. grep $userid /nwprod/fix/prodllsubmit_userids answer=$? if [ $answer -ne 0 ] then set +x echo "userid had not been requested for testing yet" echo " on mist and dew" echo "" exit set -x fi echo "running prodllsubmit on mist/dew." ### ### ### fors=`hostname | cut -c1` if [ "$fors" = "w" ] ; then hostlist=/nwprod/util/fix/interactive.hosts.white else hostlist=/nwprod/util/fix/interactive.hosts.blue fi for host in `cat $hostlist` do ping -c1 $host pingerr=$? if test $pingerr -eq 0 then export flag=normal ( sleep 90; kill -s 31 $$ ) & # set timer in a child shell # to send a SIGUSR1 signal back # to this shell script in 90 # seconds. timerpid=$! # Save pid of timer env | rsh $host -l $userid "/nwprod/util/ush/envllsubmit $script_name" & export kid=$! # assign PID of rsh command to kid # set trap for signal SIGUSR1 and kill rsh process, if received. trap " echo killing $kid; flag=sigusr1; kill -kill $kid " 31 wait $kid # wait for rsh to quit rsherr=$? trap 31 # remove SIGUSR1 signal trap if [ $flag = "normal" ] then # Stop timer kill -s TERM $timerpid fi if [ $rsherr -eq 0 ] && [ $flag = "normal" ] then exit 0 fi fi done exit 1