Test version of the shell script and macro for running the online reco @ P2.
[u/mrichter/AliRoot.git] / MONITOR / onlineReco.sh
1 #!/bin/bash
2
3 source ~/.bashrc
4
5 export BASE_DIR=/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 cd $BASE_DIR
37
38 #------------------------------------------------------------------------
39 # init GRID environment
40
41 echo; echo 'Init GRID environment...'
42 #root_alien_setup
43
44 #------------------------------------------------------------------------
45 # Setting environment
46
47 echo;
48
49 export BUILD_DIR=$BASE_DIR/build
50 source $BUILD_DIR/SetAliRoot.sh
51
52 echo;
53
54 echo Root is: `root-config --version`
55 echo AliRoot is: `aliroot --version`
56 echo;
57
58 cd $BASE_DIR
59
60 if [ ! -e $RECO_DIR/log ]
61 then
62         mkdir $RECO_DIR/log
63 fi
64
65 while [ 1 ] 
66 do
67     cd $RECO_DIR/log
68     aliroot -q $ALICE_ROOT/MONITOR/onlineReco.C\(\"listen\",\"$ALICE_ROOT/test/cosmic/rec.C\"\) | tee rec.log
69 #    mv rec.log log/run%%_rec.log
70 done
71
72 cd $BASE_DIR
73
74 # remove lock file
75 rm -f $PIDFILE
76
77 exit 0
78
79