repairing server's action after EOR signal
[u/mrichter/AliRoot.git] / MONITOR / onlineReco.sh
CommitLineData
5bea0f92 1#!/bin/bash
2
3source ~/.bashrc
4
3153d9c6 5export BASE_DIR=/local/home/offline/onlineReco
5bea0f92 6export RECO_DIR=$BASE_DIR/reco
7
8## enabling core dumps
9ulimit -c 100000000000000
10
11#----------------------------------------------------------------------
12# check that no other instances of online reconstruction are running at the same time!
13
14PIDFILE=$BASE_DIR/current.pid
15if [ -f $PIDFILE ]
16then
17 OLDPID=`cat $PIDFILE`
18 echo "Lock file $PIDFILE found. Checking process $OLDPID"
19 kill -0 $OLDPID
20 pidcheck=$?
21 if [ "$pidcheck" -eq "1" ]
22 then
23 echo "Process $OLDPID done, removing file"
24 rm -f $PIDFILE
25 else
26 echo "Process $OLDPID still running, exiting now!"
27 exit 0;
28 fi
29fi
30
31PROCNAME=`basename $0`
32CURPID=`pgrep $PROCNAME`
33echo "current process pid = " $CURPID
34echo $CURPID > $PIDFILE
35
5bea0f92 36#------------------------------------------------------------------------
37# init GRID environment
38
3153d9c6 39#echo; echo 'Init GRID environment...'
5bea0f92 40#root_alien_setup
41
42#------------------------------------------------------------------------
43# Setting environment
44
45echo;
46
47export BUILD_DIR=$BASE_DIR/build
3153d9c6 48source $BUILD_DIR/setenv.sh
49source /opt/date/setup.sh
50source /opt/dim/setup.sh
5bea0f92 51
52echo;
5bea0f92 53echo Root is: `root-config --version`
54echo AliRoot is: `aliroot --version`
55echo;
56
5bea0f92 57if [ ! -e $RECO_DIR/log ]
58then
3153d9c6 59 mkdir -p $RECO_DIR/log
5bea0f92 60fi
61
3153d9c6 62if [ ! $1 ]
63then
64 while [ 1 ]
65 do
66 cd $RECO_DIR
a6b4118c 67 aliroot -b -q $ALICE_ROOT/MONITOR/onlineReco.C\(\"listen\",\"$ALICE_ROOT/test/cosmic/rec.C\"\) | tee rec.log
3153d9c6 68 RUNNUMBER=`grep "I-AliCDBManager::Print: Run number =" rec.log | cut -d ";" -f 1 | awk '{print $5}'`
69 mv rec.log log/run$RUNNUMBER.log
70 done
71else
72 cd $RECO_DIR
a6b4118c 73 aliroot -b -q $ALICE_ROOT/MONITOR/onlineReco.C\(\"$1\",\"$ALICE_ROOT/test/cosmic/rec.C\"\) | tee rec.log
3153d9c6 74 RUNNUMBER=`grep "I-AliCDBManager::Print: Run number =" rec.log | cut -d ";" -f 1 | awk '{print $5}'`
75 mv rec.log log/run$RUNNUMBER.log
76fi
5bea0f92 77
78cd $BASE_DIR
79
80# remove lock file
81rm -f $PIDFILE
82
83exit 0
84
85