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-2004
|
---|
23 | #
|
---|
24 | #
|
---|
25 | # ========================================================================
|
---|
26 | #
|
---|
27 | #
|
---|
28 |
|
---|
29 | user=`whoami`
|
---|
30 | source /home/$user/Mars/datacenter/scripts/sourcefile
|
---|
31 |
|
---|
32 | set -C
|
---|
33 |
|
---|
34 | cd $mars
|
---|
35 |
|
---|
36 | datetime=`date +%F-%H-%M-%S`
|
---|
37 |
|
---|
38 | scriptlogpath=$logpath/run/dowebplots/`date +%Y/%m/%d`
|
---|
39 | makedir $scriptlogpath
|
---|
40 |
|
---|
41 | scriptlog=$scriptlogpath/dowebplots-$datetime.log
|
---|
42 |
|
---|
43 | date >> $scriptlog 2>&1
|
---|
44 |
|
---|
45 | lockfile=$lockpath/lock-dowebplots.txt
|
---|
46 | date > $lockfile >> $scriptlog 2>&1
|
---|
47 | checklock0=$?
|
---|
48 | case $checklock0 in
|
---|
49 | 0) echo "checklock0=$checklock0 -> continue " >> $scriptlog 2>&1;;
|
---|
50 | 1) echo "checklock0=$checklock0 -> file exists " >> $scriptlog 2>&1
|
---|
51 | echo "-> for datacheck is running -> exit" >> $scriptlog 2>&1
|
---|
52 | date >> $scriptlog 2>&1
|
---|
53 | exit;;
|
---|
54 | *) echo "checklock0=$checklock0 -> something went completely wrong" >> $scriptlog 2>&1;;
|
---|
55 | esac
|
---|
56 |
|
---|
57 |
|
---|
58 |
|
---|
59 | rootfiles=`find /www/htdocs/datacenter/ -name '*.root' -maxdepth 10 | grep -v '_I_' | grep -v '_Y_' | grep -v 'subsystemdata' | grep -v 'star_lapalma'`
|
---|
60 |
|
---|
61 | if [ "$rootfiles" = "" ]
|
---|
62 | then
|
---|
63 | echo "nothing to do -> exit" >> $scriptlog 2>&1
|
---|
64 | rm -v $lockfile >> $scriptlog 2>&1
|
---|
65 | date >> $scriptlog 2>&1
|
---|
66 | exit
|
---|
67 | fi
|
---|
68 |
|
---|
69 | echo "rootfiles: "${rootfiles[@]} >> $scriptlog 2>&1
|
---|
70 |
|
---|
71 | for rootfile in ${rootfiles[@]}
|
---|
72 | do
|
---|
73 | date >> $scriptlog 2>&1
|
---|
74 | path=`dirname $rootfile`
|
---|
75 | file=`basename $rootfile`
|
---|
76 | base=`echo $file | sed -e 's/.root$//g'`
|
---|
77 | echo "rootfile: $file" >> $scriptlog 2>&1
|
---|
78 | echo "path : $path" >> $scriptlog 2>&1
|
---|
79 | echo "base : $base" >> $scriptlog 2>&1
|
---|
80 |
|
---|
81 | X=0
|
---|
82 | while [ "$X" -le "50" ] >> $scriptlog 2>&1
|
---|
83 | do
|
---|
84 | X=$((X+1))
|
---|
85 | echo "$X. step" >> $scriptlog 2>&1
|
---|
86 |
|
---|
87 | tabfile=$path/$base-tab$X
|
---|
88 | daterootfile=`date +%Y%m%d -r $rootfile` >> $scriptlog 2>&1
|
---|
89 | dategiffile=`date +%Y%m%d -r $tabfile.gif` >> $scriptlog 2>&1
|
---|
90 | if [ "$dategiffile" = "" ]
|
---|
91 | then
|
---|
92 | echo "date of gif-file is empty -> the file $tabfile.gif doesn't exist" >> $scriptlog 2>&1
|
---|
93 | echo " -> setting date to 0 and producing gif-file..." >> $scriptlog 2>&1
|
---|
94 | dategiffile=0
|
---|
95 | fi
|
---|
96 |
|
---|
97 | echo "checking date..." >> $scriptlog 2>&1
|
---|
98 | echo "date of rootfile: $daterootfile" >> $scriptlog 2>&1
|
---|
99 | echo "date of giffile: $dategiffile" >> $scriptlog 2>&1
|
---|
100 |
|
---|
101 | if [ "$dategiffile" -gt "$daterootfile" ] >> $scriptlog 2>&1
|
---|
102 | then
|
---|
103 | echo "gif-file is older than root-file -> continue " >> $scriptlog 2>&1
|
---|
104 | continue
|
---|
105 | fi
|
---|
106 |
|
---|
107 | echo "producing ps-file with plots for tab $X..." >> $scriptlog 2>&1
|
---|
108 | ./showplot -b --save-as-ps=$tabfile --tab=$X $rootfile >> $scriptlog 2>&1
|
---|
109 | if ! ls $tabfile.ps >> $scriptlog 2>&1
|
---|
110 | then
|
---|
111 | echo "tab $X doen't exist -> break" >> $scriptlog 2>&1
|
---|
112 | break
|
---|
113 | fi
|
---|
114 | echo "converting plots to gif for tab $X..." >> $scriptlog 2>&1
|
---|
115 | convert -verbose -rotate 90 $tabfile.ps $tabfile.gif >> $scriptlog 2>&1
|
---|
116 | done
|
---|
117 | done
|
---|
118 |
|
---|
119 | rm -v $lockfile >> $scriptlog 2>&1
|
---|
120 |
|
---|
121 | set +C
|
---|
122 |
|
---|
123 | date >> $scriptlog 2>&1
|
---|
124 |
|
---|