forked from DS-CNAF/htcondor-docker-centos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·54 lines (46 loc) · 1.3 KB
/
run.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
#!/bin/bash
# Configure HTCondor and fire up supervisord
# Daemons for each role
MASTER_DAEMONS="COLLECTOR, NEGOTIATOR"
EXECUTOR_DAEMONS="STARTD"
SUBMITTER_DAEMONS="SCHEDD"
usage() {
cat <<-EOF
usage: $0 -m|-e master-address|-s master-address
Configure HTCondor role and start supervisord for this container
OPTIONS:
-m configure container as HTCondor master
-e master-address configure container as HTCondor executor for the given master
-s master-address configure container as HTCondor submitter for the given master
EOF
exit 1
}
# Get our options
ROLE_DAEMONS=
CONDOR_HOST=
while getopts ':me:s:' OPTION; do
case $OPTION in
m)
[ -n "$ROLE_DAEMONS" ] && usage
ROLE_DAEMONS="$MASTER_DAEMONS"
CONDOR_HOST='$(FULL_HOSTNAME)'
;;
e)
[ -n "$ROLE_DAEMONS" -o -z "$OPTARG" ] && usage
ROLE_DAEMONS="$EXECUTOR_DAEMONS"
CONDOR_HOST="$OPTARG"
;;
s)
[ -n "$ROLE_DAEMONS" -o -z "$OPTARG" ] && usage
ROLE_DAEMONS="$SUBMITTER_DAEMONS"
CONDOR_HOST="$OPTARG"
;;
esac
done
# Prepare HTCondor configuration
sed -i \
-e 's/@CONDOR_HOST@/'"$CONDOR_HOST"'/' \
-e 's/@ROLE_DAEMONS@/'"$ROLE_DAEMONS"'/' \
/etc/condor/condor_config
# Hand execution over to supervisord
exec /usr/bin/supervisord -c /etc/supervisord.conf