forked from mhulsman/cluster_manager
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathload_env_ipengine.sh
58 lines (47 loc) · 1.03 KB
/
load_env_ipengine.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
#/bin/bash
set -e
ENVPATH=$1
ADDRESS=$2
PORT=$3
PARAMNR=$4
ENVNAME=`basename $ENVPATH`
RANDOM=$PARAMNR
export LFC_HOME=XXLFCHOMEXX
export LFC_HOST=lfc.grid.sara.nl
#Wait a random time to not overload the server after submission of a number of jobs.
WAIT=$[ ($RANDOM % 300) ]
echo "Waiting for $WAIT seconds..."
sleep $WAIT
echo "Waiting period over for $PARAMNR, starting bootstrap."
if [ -n "$TMPDIR" ]
then
echo "Scratch directory is $TMPDIR"
else
TMPDIR=`pwd`
echo "Set scratch directory to $TMPDIR"
fi
echo "Running ulimit"
ulimit;
#load environment
chmod 744 ./gcp
./gcp $ENVPATH $TMPDIR
cp ipcontroller-engine.json $TMPDIR
cd $TMPDIR
tar -xzf $ENVNAME
CURDIR=`pwd`
cd sys_enhance
cat _paths | sed s#ONAME#$CURDIR#g > paths
echo "Where is bash?"
which bash
echo "File created?"
ls -lh ./paths
. ./paths
echo "Environment loaded for $PARAMNR, starting work."
#run job
cd work
./ipengine_chief -a $ADDRESS -p $PORT -l -t GRID
#cleaning
echo "Work for $PARAMNR finished, cleaning up..."
cd /
rm -rf $CURDIR/sys_enhance
echo "Done"