Do not include from subdirectories
[u/mrichter/AliRoot.git] / MONITOR / onlineReco.sh
1 #!/bin/bash
2
3 source ~/.bashrc
4
5 export BASE_DIR=/local/home/offline/onlineReco
6 export RECO_DIR=$BASE_DIR/reco
7
8 ## enabling core dumps
9 ulimit -c 100000000000000
10
11 #----------------------------------------------------------------------
12 # check that no other instances of online reconstruction are running at the same time!
13
14 PIDFILE=$BASE_DIR/current.pid
15 if [ -f $PIDFILE ]
16 then
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
29 fi
30
31 PROCNAME=`basename $0`
32 CURPID=`pgrep $PROCNAME`
33 echo "current process pid = " $CURPID 
34 echo $CURPID > $PIDFILE
35
36 #------------------------------------------------------------------------
37 # init GRID environment
38
39 #echo; echo 'Init GRID environment...'
40 #root_alien_setup
41
42 #------------------------------------------------------------------------
43 # Setting environment
44
45 echo;
46
47 export BUILD_DIR=$BASE_DIR/build
48 source $BUILD_DIR/setenv.sh
49 source /opt/date/setup.sh
50 source /opt/dim/setup.sh
51
52 echo;
53 echo Root is: `root-config --version`
54 echo AliRoot is: `aliroot --version`
55 echo;
56
57 if [ ! -e $RECO_DIR/log ]
58 then
59         mkdir -p $RECO_DIR/log
60 fi
61
62 if [ ! $1 ]
63 then
64     while [ 1 ] 
65       do
66       cd $RECO_DIR
67       aliroot -b -q $ALICE_ROOT/MONITOR/onlineReco.C\(\"listen\",\"$ALICE_ROOT/test/cosmic/rec.C\"\) | tee rec.log
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
71 else
72       cd $RECO_DIR
73       aliroot -b -q $ALICE_ROOT/MONITOR/onlineReco.C\(\"$1\",\"$ALICE_ROOT/test/cosmic/rec.C\"\) | tee rec.log
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
76 fi
77
78 cd $BASE_DIR
79
80 # remove lock file
81 rm -f $PIDFILE
82
83 exit 0
84
85