forked from alisw/AliRoot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathonlineReco.sh
87 lines (66 loc) · 1.91 KB
/
onlineReco.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
#!/bin/bash
source ~/.bashrc
export BASE_DIR=/local/home/offline/onlineReco
export RECO_DIR=$BASE_DIR/reco
## enabling core dumps
ulimit -c 100000000000000
#----------------------------------------------------------------------
# check that no other instances of online reconstruction are running at the same time!
PIDFILE=$BASE_DIR/current.pid
if [ -f $PIDFILE ]
then
OLDPID=`cat $PIDFILE`
echo "Lock file $PIDFILE found. Checking process $OLDPID"
kill -0 $OLDPID
pidcheck=$?
if [ "$pidcheck" -eq "1" ]
then
echo "Process $OLDPID done, removing file"
rm -f $PIDFILE
else
echo "Process $OLDPID still running, exiting now!"
exit 0;
fi
fi
PROCNAME=`basename $0`
CURPID=`pgrep $PROCNAME`
echo "current process pid = " $CURPID
echo $CURPID > $PIDFILE
#------------------------------------------------------------------------
# init GRID environment
#echo; echo 'Init GRID environment...'
#root_alien_setup
#------------------------------------------------------------------------
# Setting environment
echo;
export BUILD_DIR=$BASE_DIR/build
source $BUILD_DIR/setenv.sh
source /opt/date/setup.sh
source /opt/dim/setup.sh
echo;
echo Root is: `root-config --version`
echo AliRoot is: `aliroot --version`
echo;
if [ ! -e $RECO_DIR/log ]
then
mkdir -p $RECO_DIR/log
fi
if [ ! $1 ]
then
while [ 1 ]
do
cd $RECO_DIR
aliroot -b -q $ALICE_ROOT/MONITOR/onlineReco.C\(\"listen\",\"$ALICE_ROOT/test/cosmic/rec.C\"\) | tee rec.log
RUNNUMBER=`grep "I-AliCDBManager::Print: Run number =" rec.log | cut -d ";" -f 1 | awk '{print $5}'`
mv rec.log log/run$RUNNUMBER.log
done
else
cd $RECO_DIR
aliroot -b -q $ALICE_ROOT/MONITOR/onlineReco.C\(\"$1\",\"$ALICE_ROOT/test/cosmic/rec.C\"\) | tee rec.log
RUNNUMBER=`grep "I-AliCDBManager::Print: Run number =" rec.log | cut -d ";" -f 1 | awk '{print $5}'`
mv rec.log log/run$RUNNUMBER.log
fi
cd $BASE_DIR
# remove lock file
rm -f $PIDFILE
exit 0