-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathguided-start-ep.sh
executable file
·93 lines (66 loc) · 1.94 KB
/
guided-start-ep.sh
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
set -e
prompt () {
var=$1
shift
echo "$@"
read -p "> " "$var"
}
fail () { echo "$@" >&2; exit 1; }
git clone https://github.com/brianaydemir/htcondor_file_transfer_ep
cd htcondor_file_transfer_ep
prompt CM "Enter the central manager's hostname; Default: cm.chtc.wisc.edu"
[[ $CM ]] || CM=cm.chtc.wisc.edu
if [[ -f $TOKEN_FILE ]]; then
echo "Using existing token file: $TOKEN_FILE"
else
echo
echo "Please note the following Request ID, and ask CHTC staff to approve"
echo "this request on $CM with: condor_token_request_approve -reqid ID"
echo
./request_token.sh -c "$CM"
fi
cp .env.template .env
echo
prompt JO "Enter your user name on the AP"
[[ $JO ]] || fail "Sorry, there's no default for this setting."
xxx=$(dd bs=4c count=1 if=/dev/urandom 2>/dev/null | xxd -p)
UN_default=$JO-$xxx
prompt UN "Enter a Unique Name for this EP. Default: $UN_default"
[[ $UN ]] || UN=$UN_default
echo
echo "Enter directory on THIS HOST to mount on /data inside EP container."
prompt DD "Default: /data"
[[ $DD ]] || DD=/data
echo
echo "Enter directory on THIS HOST to store the largest file being transferred"
echo "plus 1G for log files and other ephemeral data."
prompt LD "Default: /tmp/htcondor-file-transfer-ep-$xxx"
[[ $LD ]] || LD=/tmp/htcondor-file-transfer-ep-$xxx
echo
echo "Use these settings?
CENTRAL_MANAGER=$CM;
UNIQUE_NAME=$UN;
JOB_OWNER=$JO;
DATA_DIR=$DD;
LOCAL_DIR=$LD;
"
if [[ -f $TOKEN_FILE ]]; then
echo " TOKEN_FILE=$TOKEN_FILE"
fi
prompt OK "OK? [y/N]"
[[ $OK = [yY] ]] || fail Quitting.
sed -i "s;CENTRAL_MANAGER=.*;CENTRAL_MANAGER=$CM;
s;UNIQUE_NAME=.*;UNIQUE_NAME=$UN;
s;JOB_OWNER=.*;JOB_OWNER=$JO;
s;DATA_DIR=.*;DATA_DIR=$DD;
s;LOCAL_DIR=.*;LOCAL_DIR=$LD;" .env
if [[ -f $TOKEN_FILE ]]; then
sed -i "s;TOKEN_FILE=.*;TOKEN_FILE=$TOKEN_FILE;" .env
fi
echo
echo "Starting the singularity container..."
echo
./run_singularity.sh
echo
echo "To stop, run: singularity instance stop"