Skip to content

Commit

Permalink
job handling script files
Browse files Browse the repository at this point in the history
  • Loading branch information
joshStillerman committed May 30, 2002
1 parent 041d3dc commit eac1d90
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
30 changes: 30 additions & 0 deletions scripts/Makefile.in
Original file line number Diff line number Diff line change
@@ -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@
11 changes: 11 additions & 0 deletions scripts/synchronize_unix
Original file line number Diff line number Diff line change
@@ -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
35 changes: 35 additions & 0 deletions scripts/unix_submit
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit eac1d90

Please sign in to comment.