#!/bin/sh # js_script # # Example ScriptedJob script # David Adams # June 2005 # # Install this script in any directory and then modify scheduler.xml # to use ScriptedJobCreator and point to the full path to this file. NAME=`basename $0` DIR=`dirname $0` ACTION=$1 ARG=$2 LOG=js_out.log RES=job_response.dat echo >> $LOG date >> $LOG echo $NAME called with action $ACTION >> $LOG if [ -r $RES ]; then echo Error: Found $RES >> $LOG fi rm -f $RES touch $RES if [ $ACTION = create ]; then # Copy credential. cp cred.tmp cred.dat else if [ $ACTION = start ]; then EXE=$2 # Start job rm -f js_started $DIR/js_runit $EXE& # Wait for js_started while [ ! -r js_started ]; do sleep 1 done echo set_running >> $RES echo set_run_host `hostname` >> $RES echo set_local_id `cat js_pid` >> $RES else if [ $ACTION = update ]; then if [ -r js_done ]; then echo set_done >> $RES fi else if [ $ACTION = kill ]; then kill `cat js_pid` echo set_killed >> $RES fi; fi; fi; fi