diff --git a/scripts/Makefile.in b/scripts/Makefile.in new file mode 100644 index 0000000000..e76e8d0782 --- /dev/null +++ b/scripts/Makefile.in @@ -0,0 +1,30 @@ +SHELL=/bin/sh +top_srcdir=@top_srcdir@ +RM=$(top_srcdir)/devscripts/rm_if +prefix=@prefix@ +exec_prefix=@exec_prefix@ +INSTALL=@top_srcdir@/conf/install-sh -c + +SCRIPTS = \ + @MAKEBINDIR@unix_submit \ + @MAKEBINDIR@synchronize_unix + +all : @MAKEBINDIR@ \ + $(SCRIPTS) + +clean : + @ $(RM) $(SCRIPTS) + +install: + for script in $(SCRIPTS) ; do\ + $(INSTALL) -m 755 $${script} @bindir@;\ + done + +@MAKEBINDIR@unix_submit : unix_submit + cp unix_submit @MAKEBINDIR@unix_submit + +@MAKEBINDIR@synchronize_unix : synchronize_unix + cp synchronize_unix @MAKEBINDIR@sychronize_unix + +@MAKEBINDIR@ : + mkdir @MAKEBINDIR@ diff --git a/scripts/synchronize_unix b/scripts/synchronize_unix new file mode 100644 index 0000000000..b52677d56c --- /dev/null +++ b/scripts/synchronize_unix @@ -0,0 +1,11 @@ +if [ "x$MDS_LOGS" = "x" ]; then + MDS_LOGS="/var/log/mdsplus"; +fi +if [ -d $MDS_LOGS -a -w $MDS_LOGS ]; then + FILE=`basename $1 ".sh"` + LOCKFILE="$MDS_LOGS/$FILE.$2.log.lock" + lockfile -1 $LOCKFILE + rm -f $LOCKFILE +else + echo "Directory MDS_LOGS ($MDS_LOGS) must exist and be writeable" +fi diff --git a/scripts/unix_submit b/scripts/unix_submit new file mode 100755 index 0000000000..6435fd198c --- /dev/null +++ b/scripts/unix_submit @@ -0,0 +1,35 @@ +#!/bin/sh +# +# file: /usr/local/mdsplus/bin/unix_submit.sh +# +# shell script to spawn a batch job for automatic intershot analysis. +# +# called by unix_submit.fun +# +# procedure: +# build a log file name from the base file name +# (logs go to /var/mdsplus/log) +# insert a status line for this shot +# invoke the job with the shot number as $1 redirecting stdout and err +# to the end of the log file +# insert a done status line for this shot + +FILE=`basename $1 ".sh"` +if [ "x$MDS_LOGS" = "x" ]; then + MDS_LOGS="/var/log/mdsplus"; +fi +if [ -d "$MDS_LOGS" -a -w "$MDS_LOGS" ]; then + LOG="$MDS_LOGS/$FILE.$2.log" + CUMULATIVE_LOG="$MDS_LOGS/$FILE.log" + lockfile "$LOG.lock" + echo ">>>>>>>>>>>>>>>>>>>>> $2 >>>>>>>>>>>>>>>>>>>>" >> $LOG + date >> $LOG + /usr/bin/time -a -f "Elapsed %E\tUser %U\tSystem %S" -o $LOG $1 $2 >>$LOG 2>&1 + echo "<<<<<<<<<<<<<<<<<<<<< $2 <<<<<<<<<<<<<<<<<<<<" >> $LOG + echo " " > $LOG + cat $LOG >> $CUMULATIVE_LOG + rm -f $LOG + rm -f "$LOG.lock" +else + echo "Directory MDS_LOGS ($MDS_LOGS) must exist and be writeable" +fi