source: SuperB-LAL/trunk/slacExperiment_USBWC-CRT/backupUSBWCData.csh

Last change on this file was 14, checked in by narnaud, 14 years ago

Initial commit

File size: 4.0 KB
Line 
1#!/bin/csh
2
3if ($#argv != 1 && $#argv != 3 ) then
4  echo "Usage: source backupUSBWCData.csh <USBWC run name>"
5  echo "       or"
6  echo "       source backupUSBWCData.csh <USBWC run name> <index of the first file to backup> <index of the last file to backup>"
7  exit
8endif
9
10set currentRun = $1
11echo "currentRun = $currentRun"
12
13set underscore = "_"
14
15if($#argv == 3 ) then
16  set first = $2
17  if( $first < 10 ) then
18    set firstString = "000$first"
19  else
20    if( $first < 100 ) then
21      set firstString = "00$first"
22    else
23      if( $first < 1000 ) then
24        set firstString = "0$first"
25      endif
26    endif
27  endif
28
29  set last  = $3
30  if( $last < 10 ) then
31    set lastString = "000$last"
32  else
33    if( $last < 100 ) then
34      set lastString = "00$last"
35    else
36      if( $last < 1000 ) then
37        set lastString = "0$last"
38      endif
39    endif
40  endif
41
42  echo "Backuping files with indexes between $firstString and $lastString"
43
44  set archiveName = "$currentRun-$firstString$underscore$lastString.tar"
45else
46  set archiveName = "$currentRun.tar"
47endif
48
49echo "archiveName = $archiveName"
50
51set gzippedArchiveName = "$archiveName.gz"
52
53cd /nfs/farm/g/superb/u02/crt/usbWaveCatcher/RawData/$currentRun
54
55if( -e $gzippedArchiveName ) then
56  mv $gzippedArchiveName $gzippedArchiveName.old
57endif
58
59echo "Creating the tar file"
60
61if($#argv == 1 ) then
62  tar -cvf $archiveName *.dat*
63else
64  set list = `ls -1 *.dat_* | awk -F "_" '{ print $NF " " $0}' | sort -n | awk '{ if( $1 >= '"$first"' && $1 <= '"$last"' ) { print $2 " "; } }'`
65  #echo "list = *** $list ***"
66  tar -cvf $archiveName $list
67endif
68
69echo "Compressing the tar file"
70
71gzip $archiveName
72
73#echo "Moving the gzipped tar file to the Backup/ directory"
74
75mv $gzippedArchiveName ../Backup/
76
77cd -
78
79#########################################################################
80
81# ==================================================== #
82# Directories below should have been properly archived #
83# => Move this comment above previous directory once = #
84# corresponding run is finished ====================== #
85# ==================================================== #
86
87#set currentRun = "20101102"
88
89#cd /nfs/farm/g/superb/u02/crt/usbWaveCatcher/RawData/$currentRun
90#if( -e $currentRun.tar.gz ) then
91#  mv $currentRun.tar.gz $currentRun.tar.gz.old
92#endif
93#echo "Creating the tar file"
94#tar -cvf $currentRun.tar *.dat*
95#echo "Compressing the tar file"
96#gzip $currentRun.tar
97#echo "Moving the gzipped tar file to the Backup/ directory"
98#mv *.tar.gz ../Backup/
99#cd -
100
101#cd /nfs/farm/g/superb/u02/crt/usbWaveCatcher/RawData/20101101
102#if( -e 20101101.tar.gz ) then
103#  mv 20101101.tar.gz 20101101.tar.gz.old
104#endif
105#echo "Creating the tar file"
106#tar -cvf 20101101.tar *.dat*
107#echo "Compressing the tar file"
108#gzip 20101101.tar
109#echo "Moving the gzipped tar file to the Backup/ directory"
110#mv *.tar.gz ../Backup/
111#cd -
112
113#cd /nfs/farm/g/superb/u02/crt/usbWaveCatcher/RawData/20101025
114#if( -e 20101025.tar.gz ) then
115#  mv 20101025.tar.gz 20101025.tar.gz.old
116#endif
117#echo "Creating the tar file"
118#tar -cvf 20101025.tar *.dat*
119#echo "Compressing the tar file"
120#gzip 20101025.tar
121#echo "Moving the gzipped tar file to the Backup/ directory"
122#mv *.tar.gz ../Backup/
123#cd -
124
125#cd /nfs/farm/g/superb/u02/crt/usbWaveCatcher/RawData/20101020
126#tar -cvf 20101020.tar *.dat*
127#gzip 20101020.tar
128#mv *.tar.gz ../Backup/
129#cd -
130
131#cd /nfs/farm/g/superb/u02/crt/usbWaveCatcher/RawData/20101019
132#tar -cvf 20101019.tar *.dat*
133#gzip 20101019.tar
134#mv *.tar.gz ../Backup/
135#cd -
136
137#cd /nfs/farm/g/superb/u02/crt/usbWaveCatcher/RawData/20101010
138#tar -cvf 20101010.tar *.dat*
139#gzip 20101010.tar
140#mv *.tar.gz ../Backup/
141#cd -
142
143#cd /nfs/farm/g/superb/u02/crt/usbWaveCatcher/RawData/20101005_overnight_nicolas
144#tar -cvf 20101005_overnight_nicolas.tar *.dat*
145#gzip 20101005_overnight_nicolas.tar
146#mv *.tar.gz ../Backup/
147#cd -
148
149#cd /nfs/farm/g/superb/u02/crt/usbWaveCatcher/RawData/20101004_overnight_nicolas
150#tar -cvf 20101004_overnight_nicolas.tar *.dat*
151#gzip 20101004_overnight_nicolas.tar
152#mv *.tar.gz ../Backup/
153#cd -
154
155#cd /nfs/farm/g/superb/u02/crt/usbWaveCatcher/RawData/Run_16_cosmic_Data_9_24_2010
156#mv *.gz ../Backup/
157#cd -
Note: See TracBrowser for help on using the repository browser.