-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsubmit
executable file
·63 lines (52 loc) · 1.5 KB
/
submit
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
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
source /usr/global/Anaconda/2019-10/etc/profile.d/conda.sh
USR=`logname`
BACKUP=true;
CHECK_USER=false;
SCRIPT_ARGS=()
for arg in "$@"; do
case "$arg" in
"--no-backup") BACKUP=false;;
"--ignore-user") CHECK_USER=false;
BACKUP=false;;
"--help") echo "usage: submit {--ignore-user --no-backup}";;
*)SCRIPT_ARGS+=("$arg");;
esac
done
if $CHECK_USER; then
case $USER in
"RAM_maint") INDEX="/protocols/r1.json";;
"maint") INDEX="/protocols/ltp.json";;
* ) echo "This script is meant to be run from maint or RAM_maint not $USR";
exit;;
esac
fi
if $BACKUP; then
REPO="$HOME/index_file_tracker/"
echo "$REPO"
TIME=$(date "+%Y.%m.%d at %H.%M.%S")
cp "$INDEX" "$REPO"
cd "$REPO"
# we don't have git >1.8, so change directories
# git -C "$REPO" add .
git add .
git commit -m "Checkpoint for modifications made $TIME"
cd -
fi
if [[ ${HOSTNAME:0:4} != "node" ]]; then
while true; do
echo "This script is best run from a node not the headnode (use qlogin)"
read -p "Are you sure you want to continue? " yn
case $yn in
[Nn]* ) exit;;
[Yy]* ) break;;
* ) echo "Please answer y/n";;
esac
done
fi
#USER_HOME=`eval echo ~$USR`
#XAUTH_LINE=`xauth -f $USER_HOME/.Xauthority list | tail -1`
#xauth add $XAUTH_LINE
#source ~/.bashrc
# conda activate event_creation
python -m event_creation.submission.convenience "${SCRIPT_ARGS[@]}"