Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
#!/bin/bash

set -euo pipefail

! [ "$(git status --porcelain)" ] || (echo "please commit everything before running"; git status; exit 1)

voms-proxy-info | grep timeleft | grep -v -q 00:00:00 || (echo 'no proxy'; exit 1)

(echo $TMUX > /dev/null) || (echo "run this on a screen"; exit 1)

#hpnumber=
hptype=hp   #or sm
extraopts="--redirectproxy"

#common=Configurations/common_cff_py_pickyours.txt
#lstfile=DataFiles/pickyours.lst
#IOVfile=IOV/RunYYYYYY
#alignmentname=pick a name
#niterations=pick a number

[ -e $lstfile ] || (echo "$lstfile does not exist!"; exit 1)
[ -e $common ] || (echo "$common does not exist!"; exit 1)
[ -e $IOVfile ] || (echo "$IOVfile does not exist!"; exit 1)

commitid=$(git rev-parse HEAD)

git tag $hptype$hpnumber $commitid || (
  status=$?
  if [ $(git rev-parse HEAD) == $(git rev-parse $hptype$hpnumber) ]; then
    exit 0  #from the parentheses
  fi
  echo
  echo "failed to make the tag, see ^"
  echo
  echo "if you previously tried to start the alignment but it failed,"
  echo "you can delete the tag by doing"
  echo
  echo "  git tag --delete $hptype$hpnumber"
  echo
  exit $status
)

submitAndWatchHippy.sh $alignmentname \
                       $niterations \
                       $hptype$hpnumber \
                       $common \
                       Configurations/align_tpl_py.txt \
                       Configurations/TrackSelection \
                       $lstfile \
                       $IOVfile \
                       "$extraopts"