source: trunk/MagicSoft/Mars/datacenter/scripts/zipscript@ 8006

Last change on this file since 8006 was 7970, checked in by Daniela Dorner, 18 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 3.9 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 09/2006 <mailto:dorner@astro.uni-wuerzburg.de>
21#
22# Copyright: MAGIC Software Development, 2000-2006
23#
24#
25# ========================================================================
26#
27# This script zips the incoming rawfiles.
28#
29
30source `dirname $0`/sourcefile
31printprocesslog "INFO starting $0"
32program=zipscript
33
34set -C
35
36rawdatapath=$datapath/rawfiles
37files=`find $rawdatapath -type f -name '*.raw'`
38
39scriptlog=$runlogpath/$program-$datetime.log
40date >> $scriptlog 2>&1
41
42# check if script is already running
43lockfile=$lockpath/lock-$program.txt
44checklock >> $scriptlog 2>&1
45
46
47if [ "$files" == "" ]
48then
49 echo "no files to zip" >> $scriptlog 2>&1
50 finish >> $scriptlog 2>&1
51fi
52
53for file in ${files[@]}
54do
55 echo "zipping $file ..." >> $scriptlog 2>&1
56 if ssh pegasus nice -n 19 gzip -1f $file >> $scriptlog 2>&1
57 then
58 chmod a-w $file >> $scriptlog 2>&1
59 fi
60done
61
62finish >> $scriptlog 2>&1
63
64
65
66# old code for running script locally
67
68#rawdatapath=$datapath/rawfiles
69##h: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
70#pnos=( 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 )
71#sl1=30 #sleeping time before new directory
72#sl2=60 #sleeping time before new process check
73#
74#dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort`
75##dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort -r`
76#
77#for dir in ${dirs[@]}
78#do
79# cont=`echo $dir | cut -d/ -f7`
80# if [ "$cont" == "" ]
81# then
82# continue
83# fi
84#
85# if ! ls $dir/*.raw >/dev/null 2>&1
86# then
87# echo "no unzipped rawfiles in $dir left"
88# continue
89# fi
90#
91# echo "sleeping $sl1..."
92# sleep $sl1
93#
94# h=`date +%k`
95# count=`ps aux | grep gzip | grep -v grep | wc -l`
96# echo "count: $count - h: $h - pno: ${pnos[$h]}"
97# while [ "$count" -ge "${pnos[$h]}" ]
98# do
99# echo "sleeping $sl2..."
100# sleep $sl2
101# h=`date +%k`
102# count=`ps aux | grep gzip | grep -v grep | wc -l`
103# echo "count: $count - h: $h - pno: ${pnos[$h]}"
104# done
105# echo $dir
106# du -hs $dir
107# echo "gzip -1f $dir/*.raw &"
108# gzip -1f $dir/*.raw &
109#done
110#
111
112
113# old code for running script with condor
114
115#rawdatapath=$datapath/rawfiles
116##h: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
117#pnos=( 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 )
118#sl1=30 #sleeping time before new directory
119#sl2=60 #sleeping time before new process check
120#
121#dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort`
122##dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort -r`
123#
124#for dir in ${dirs[@]}
125#do
126# cont=`echo $dir | cut -d/ -f7`
127# if [ "$cont" == "" ]
128# then
129# continue
130# fi
131#
132# if ! ls $dir/*.raw >/dev/null 2>&1
133# then
134# echo "no unzipped rawfiles in $dir left"
135# continue
136# fi
137#
138# echo "sleeping $sl1..."
139# sleep $sl1
140#
141# h=`date +%k`
142# count=`grep gzip .condor_run.* | wc -l`
143# echo "count: $count - h: $h - pno: ${pnos[$h]}"
144# while [ "$count" -ge "${pnos[$h]}" ]
145# do
146# echo "sleeping $sl2..."
147# sleep $sl2
148# h=`date +%k`
149# count=`grep gzip .condor_run.* | wc -l`
150# echo "count: $count - h: $h - pno: ${pnos[$h]}"
151# done
152# echo $dir
153# du -hs $dir
154# condor_run gzip -1f $dir/*.raw &
155#
156#done
157#
158
Note: See TracBrowser for help on using the repository browser.