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

Last change on this file since 7964 was 7964, 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 ssh pegasus nice -n 19 gzip -1f $file >> $scriptlog 2>&1
57done
58
59finish >> $scriptlog 2>&1
60
61
62
63# old code for running script locally
64
65#rawdatapath=$datapath/rawfiles
66##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
67#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 )
68#sl1=30 #sleeping time before new directory
69#sl2=60 #sleeping time before new process check
70#
71#dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort`
72##dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort -r`
73#
74#for dir in ${dirs[@]}
75#do
76# cont=`echo $dir | cut -d/ -f7`
77# if [ "$cont" == "" ]
78# then
79# continue
80# fi
81#
82# if ! ls $dir/*.raw >/dev/null 2>&1
83# then
84# echo "no unzipped rawfiles in $dir left"
85# continue
86# fi
87#
88# echo "sleeping $sl1..."
89# sleep $sl1
90#
91# h=`date +%k`
92# count=`ps aux | grep gzip | grep -v grep | wc -l`
93# echo "count: $count - h: $h - pno: ${pnos[$h]}"
94# while [ "$count" -ge "${pnos[$h]}" ]
95# do
96# echo "sleeping $sl2..."
97# sleep $sl2
98# h=`date +%k`
99# count=`ps aux | grep gzip | grep -v grep | wc -l`
100# echo "count: $count - h: $h - pno: ${pnos[$h]}"
101# done
102# echo $dir
103# du -hs $dir
104# echo "gzip -1f $dir/*.raw &"
105# gzip -1f $dir/*.raw &
106#done
107#
108
109
110# old code for running script with condor
111
112#rawdatapath=$datapath/rawfiles
113##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
114#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 )
115#sl1=30 #sleeping time before new directory
116#sl2=60 #sleeping time before new process check
117#
118#dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort`
119##dirs=`find $rawdatapath -type d | grep -v timecorrlogs | sort -r`
120#
121#for dir in ${dirs[@]}
122#do
123# cont=`echo $dir | cut -d/ -f7`
124# if [ "$cont" == "" ]
125# then
126# continue
127# fi
128#
129# if ! ls $dir/*.raw >/dev/null 2>&1
130# then
131# echo "no unzipped rawfiles in $dir left"
132# continue
133# fi
134#
135# echo "sleeping $sl1..."
136# sleep $sl1
137#
138# h=`date +%k`
139# count=`grep gzip .condor_run.* | wc -l`
140# echo "count: $count - h: $h - pno: ${pnos[$h]}"
141# while [ "$count" -ge "${pnos[$h]}" ]
142# do
143# echo "sleeping $sl2..."
144# sleep $sl2
145# h=`date +%k`
146# count=`grep gzip .condor_run.* | wc -l`
147# echo "count: $count - h: $h - pno: ${pnos[$h]}"
148# done
149# echo $dir
150# du -hs $dir
151# condor_run gzip -1f $dir/*.raw &
152#
153#done
154#
155
Note: See TracBrowser for help on using the repository browser.