-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjalien-ce.sh
executable file
·69 lines (62 loc) · 2.08 KB
/
jalien-ce.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
#!/bin/bash
# Starting script for ML
# v0.1
# kwijethu@cern.ch
function run_ce() {
command=$1
logDir=${ALICE_LOGDIR-"${HOME}/ALICE/alien-logs"}
jalienConfigPath=${2-"${HOME}/.jalien/CE"}
jalienBinPath="${HOME}/jalien"
envCommand="/cvmfs/alice.cern.ch/bin/alienv printenv JAliEn"
envFile="$logDir/ce-env.sh"
if [[ $command = "start" ]]
then
# Read JAliEn config files
if [[ -f "$jalienConfigPath/versions" ]]
then
declare -A jalienConfiguration
while IFS= read -r line
do
if [[ ! $line = \#* ]] && [[ ! -z $line ]]
then
key=$(echo $line| cut -d "=" -f 1 | xargs )
val=$(echo $line | cut -d "=" -f 2- | xargs)
jalienConfiguration[${key^^}]=$val
fi
done <<< "$jalienConfigPath/versions"
fi
# Check for JAliEn package
if [[ -v "jalienConfiguration[CLASSPATH]" ]]
then
echo "CLASSPATH=${jalienConfiguration[CLASSPATH]}; export CLASSPATH" >> $envFile
fi
# Check for JAliEn version
if [[ -v "jalienConfiguration[JAliEn]" ]]
then
envVersionCommand="$envCommand::${jalienConfiguration[JAliEn]}"
$envVersionCommand >> $envFile
source $envFile
else
$envCommand >> $envFile
source $envFile
fi
mkdir -p $logDir/CE || { echo "Please set VoBox log directory in the LDAP and try again.." && exit 1; }
echo "Starting JAliEn CE"
nohup $jalienBinPath ComputingElement > "$logDir/CE/CE.log" 2>"$logDir/CE/CE.err" &
echo $! > "$logDir/CE/CE.pid"
elif [[ $command = "stop" ]]
then
echo "Stopping JAliEn CE"
pkill -f alien.site.ComputingElement
elif [[ $command = "status" ]]
then
if ps -p $(cat $logDir/CE/CE.pid) > /dev/null 2>&1
then
echo "JAliEn CE is running"
else
echo "JAliEn CE is NOT running!"
fi
else
echo "Command must be one of: 'start', 'stop' or 'status'"
fi
}