source: trunk/Mars/datacenter/scripts/condorstatistics@ 18290

Last change on this file since 18290 was 9100, checked in by Daniela Dorner, 16 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 3.0 KB
Line 
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
40source `dirname $0`/sourcefile
41printprocesslog "INFO starting $0"
42program=condorstatistics
43
44set -C
45
46scriptlog=$runlogpath/$program-$datetime.log
47date >> $scriptlog 2>&1
48
49# check if script is already running
50lockfile=$lockpath/lock-$program.txt
51checklock >> $scriptlog 2>&1
52
53condorpath=$logpath/condor
54dates=`find $condorpath -mindepth 3 -maxdepth 3 -type d -regex "^$condorpath/20[01][0-9]/[01][0-9]/[0-3][0-9]$"`
55
56for date in ${dates[@]}
57do
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
86done
87
88finish >> $scriptlog 2>&1
89
Note: See TracBrowser for help on using the repository browser.