#! /bin/sh # ______________________________________________________________________ # # Command to pick a given set of (run,events) from SAM. 28SEP01, HLM # # For help, use -h option. # ______________________________________________________________________ # SCRIPTNAME="pick_events" # Name of this script PICKEVENT="pick_events.py" # Actual command to be run SCRIPTPATH="$D0TOOLS_BIN" # Location of this script MODE="batch" # Mode to run this command in OUT="pick_events.out" # Output file for batch jobs LOG="pick_events.log" # Log file for batch jobs QUEUE="short" # Batch queue MACHINE="d0mino" # Batch machine # ________________________________________ # # Help mode for var in $*; do if [ "$var" = "-h" ]; then $PICKEVENT --help | less exit elif [ "$var" = "--help" ]; then $PICKEVENT --help | less exit fi done # ________________________________________ # # Process command line options PARAMS="" # This will hold command line options to pass to actual command for var in $*; do # If user specified -defname, must be SAM if [ `echo "$var" | grep -c "\--batch"` != 0 ]; then MODE="batch" elif [ `echo "$var" | grep -c "\--interactive="` != 0 ]; then MODE="interactive" elif [ `echo "$var" | grep -c "\--out="` != 0 ]; then OUT=`echo "$var"| sed 's/\--out=//'` elif [ `echo "$var" | grep -c "\--log="` != 0 ]; then LOG=`echo "$var"| sed 's/\--log=//'` elif [ `echo "$var" | grep -c "\--queue="` != 0 ]; then QUEUE=`echo "$var"| sed 's/\--queue=//'` elif [ `echo "$var" | grep -c "\--machine="` != 0 ]; then MACHINE=`echo "$var"| sed 's/\--machine=//'` else PARAMS="$PARAMS $var" fi done if [ $MODE == "interactive" ]; then $PICKEVENT $PARAMS else command="bsub -o $OUT -e $LOG -m $MACHINE -q $QUEUE $PICKEVENT $PARAMS" $command fi