| 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  08/2005 <mailto:dorner@astro.uni-wuerzburg.de> | 
|---|
| 21 | # | 
|---|
| 22 | #   Copyright: MAGIC Software Development, 2000-2006 | 
|---|
| 23 | # | 
|---|
| 24 | # | 
|---|
| 25 | # ======================================================================== | 
|---|
| 26 | # | 
|---|
| 27 | # This script produces the qualityplots in the web by executing the macro | 
|---|
| 28 | # plotdb.C | 
|---|
| 29 | # | 
|---|
| 30 | # After checking, if the script is already running, the plots are produced | 
|---|
| 31 | # (ps and root file). Then they are moved to the webdirectory and there png | 
|---|
| 32 | # files are produced from the ps file. | 
|---|
| 33 | # | 
|---|
| 34 |  | 
|---|
| 35 | user=`whoami` | 
|---|
| 36 | source /home/$user/Mars/datacenter/scripts/sourcefile | 
|---|
| 37 |  | 
|---|
| 38 | set -C | 
|---|
| 39 |  | 
|---|
| 40 | cd $mars | 
|---|
| 41 |  | 
|---|
| 42 | datetime=`date +%F-%H-%M-%S` | 
|---|
| 43 |  | 
|---|
| 44 | scriptlogpath=$logpath/run/doqualityplots/`date +%Y/%m/%d` | 
|---|
| 45 | makedir $scriptlogpath | 
|---|
| 46 |  | 
|---|
| 47 | scriptlog=$scriptlogpath/doqualityplots-$datetime.log | 
|---|
| 48 |  | 
|---|
| 49 | date >> $scriptlog 2>&1 | 
|---|
| 50 |  | 
|---|
| 51 | # check if script is already running | 
|---|
| 52 | lockfile=$lockpath/lock-doqualityplots.txt | 
|---|
| 53 | date > $lockfile >> $scriptlog 2>&1 | 
|---|
| 54 | checklock0=$? | 
|---|
| 55 | case $checklock0 in | 
|---|
| 56 | 0)   echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;; | 
|---|
| 57 | 1)   echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1 | 
|---|
| 58 | echo "-> for datacheck is running -> exit" >> $scriptlog 2>&1 | 
|---|
| 59 | date  >> $scriptlog 2>&1 | 
|---|
| 60 | exit;; | 
|---|
| 61 | *)   echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;; | 
|---|
| 62 | esac | 
|---|
| 63 |  | 
|---|
| 64 | # producing the plots with the values from the database | 
|---|
| 65 | echo "producing plots: " >> $scriptlog 2>&1 | 
|---|
| 66 | check0=`root -q -b $macrospath/plotdb.C+\(\) | tee -a $scriptlog | grep int | sed -e 's/.*(int)//'` | 
|---|
| 67 |  | 
|---|
| 68 | case $check0 in | 
|---|
| 69 | 1)   echo "check0=$check0 -> everything ok -> move files" >> $scriptlog 2>&1;; | 
|---|
| 70 | *)   echo "check0=$check0 -> ERROR -> couldn't create plots -> exit" >> $scriptlog 2>&1 | 
|---|
| 71 | rm -v $lockfile >> $scriptlog 2>&1 | 
|---|
| 72 | exit;; | 
|---|
| 73 | esac | 
|---|
| 74 |  | 
|---|
| 75 | # making files available in the web | 
|---|
| 76 | webpath=/www/htdocs/datacenter/datacheck | 
|---|
| 77 | name=plotdb | 
|---|
| 78 | psfile=$webpath/$name.ps | 
|---|
| 79 |  | 
|---|
| 80 | echo "moving files: " >> $scriptlog 2>&1 | 
|---|
| 81 | mv -v $name.{root,ps} $webpath  >> $scriptlog 2>&1 | 
|---|
| 82 |  | 
|---|
| 83 | echo "producing png files: " >> $scriptlog 2>&1 | 
|---|
| 84 | pstoimg -antialias -flip r270 -density 100 -type png -multipage $psfile >> $scriptlog 2>&1 | 
|---|
| 85 |  | 
|---|
| 86 | rm -v $lockfile >> $scriptlog 2>&1 | 
|---|
| 87 |  | 
|---|
| 88 | set +C | 
|---|
| 89 |  | 
|---|
| 90 | date  >> $scriptlog 2>&1 | 
|---|
| 91 |  | 
|---|