| 1 | #!/bin/sh
|
|---|
| 2 | #
|
|---|
| 3 | # ========================================================================
|
|---|
| 4 | #
|
|---|
| 5 | # *
|
|---|
| 6 | # * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
|---|
| 7 | # * Software. It is distributed to you in the hope that it can be a useful
|
|---|
| 8 | # * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
|---|
| 9 | # * It is distributed WITHOUT ANY WARRANTY.
|
|---|
| 10 | # *
|
|---|
| 11 | # * Permission to use, copy, modify and distribute this software and its
|
|---|
| 12 | # * documentation for any purpose is hereby granted without fee,
|
|---|
| 13 | # * provided that the above copyright notice appear in all copies and
|
|---|
| 14 | # * that both that copyright notice and this permission notice appear
|
|---|
| 15 | # * in supporting documentation. It is provided "as is" without express
|
|---|
| 16 | # * or implied warranty.
|
|---|
| 17 | # *
|
|---|
| 18 | #
|
|---|
| 19 | #
|
|---|
| 20 | # Author(s): Daniela Dorner 07/2008 <mailto:dorner@astro.uni-wuerzburg.de>
|
|---|
| 21 | #
|
|---|
| 22 | # Copyright: MAGIC Software Development, 2000-2008
|
|---|
| 23 | #
|
|---|
| 24 | #
|
|---|
| 25 | # ========================================================================
|
|---|
| 26 | #
|
|---|
| 27 | # This script reads the output of the cronjob
|
|---|
| 28 | # /usr/local/bin/condor_status -state
|
|---|
| 29 | # which is stored in /magic/datacenter/autologs/condor/YYYY/MM/DD
|
|---|
| 30 | # and fills it to the database (table CondorStatus).
|
|---|
| 31 | # The output of the cronjob
|
|---|
| 32 | # /usr/local/bin/condor_userprio -all -usage -activefrom 1 1 2000
|
|---|
| 33 | # is not jet filled.
|
|---|
| 34 | # After filling the directories are tared.
|
|---|
| 35 | #
|
|---|
| 36 | # From the database plots are produced (root, pdf and png files) and
|
|---|
| 37 | # moved to the webdirectory.
|
|---|
| 38 | #
|
|---|
| 39 |
|
|---|
| 40 | source `dirname $0`/sourcefile
|
|---|
| 41 | printprocesslog "INFO starting $0"
|
|---|
| 42 | program=condorstatistics
|
|---|
| 43 |
|
|---|
| 44 | set -C
|
|---|
| 45 |
|
|---|
| 46 | scriptlog=$runlogpath/$program-$datetime.log
|
|---|
| 47 | date >> $scriptlog 2>&1
|
|---|
| 48 |
|
|---|
| 49 | # check if script is already running
|
|---|
| 50 | lockfile=$lockpath/lock-$program.txt
|
|---|
| 51 | checklock >> $scriptlog 2>&1
|
|---|
| 52 |
|
|---|
| 53 | condorpath=$logpath/condor
|
|---|
| 54 | dates=`find $condorpath -mindepth 3 -maxdepth 3 -type d -regex "^$condorpath/20[01][0-9]/[01][0-9]/[0-3][0-9]$"`
|
|---|
| 55 |
|
|---|
| 56 | for date in ${dates[@]}
|
|---|
| 57 | do
|
|---|
| 58 | cd $mars
|
|---|
| 59 |
|
|---|
| 60 | echo "filling condor statistics for $date... " >> $scriptlog 2>&1
|
|---|
| 61 | printprocesslog "INFO filling condor statistics for $date"
|
|---|
| 62 | check0=`root -q -b $macrospath/fillcondor.C+\("\"$date\""\,kFALSE\) | tee -a $scriptlog | intgrep`
|
|---|
| 63 |
|
|---|
| 64 | case $check0 in
|
|---|
| 65 | 1) echo " check0=$check0 -> everything ok -> move files" >> $scriptlog 2>&1
|
|---|
| 66 | printprocesslog "INFO condor statistic filled succesfully"
|
|---|
| 67 | day=`basename $date`
|
|---|
| 68 | cd `dirname $date`
|
|---|
| 69 | if ! tar -czf $day.tar.gz $day/* >> $scriptlog 2>&1
|
|---|
| 70 | then
|
|---|
| 71 | printprocesslog "WARN tarring $date failed"
|
|---|
| 72 | echo "tarring $date failed" >> $scriptlog 2>&1
|
|---|
| 73 | else
|
|---|
| 74 | if ! rm -r $day >> $scriptlog 2>&1
|
|---|
| 75 | then
|
|---|
| 76 | printprocesslog "WARN removing of $date failed"
|
|---|
| 77 | fi
|
|---|
| 78 | fi
|
|---|
| 79 | cd $mars
|
|---|
| 80 | ;;
|
|---|
| 81 | *) echo " check0=$check0 -> ERROR -> couldn't fill condor statistic to DB -> exit" >> $scriptlog 2>&1
|
|---|
| 82 | printprocesslog "ERROR filling condor statistic to DB failed"
|
|---|
| 83 | finish >> $scriptlog 2>&1
|
|---|
| 84 | ;;
|
|---|
| 85 | esac
|
|---|
| 86 | done
|
|---|
| 87 |
|
|---|
| 88 | finish >> $scriptlog 2>&1
|
|---|
| 89 |
|
|---|