root/branches/newmole/scripts/nightly_copy_data.pl

Revision 367, 8.4 kB (checked in by gary, 3 years ago)

rename scripts so that all nightly scripts have names starting nightly_xxx

reorder dir work in nightly_copy_tsuite.pl so that cluster work done first, so that, in case of abort, unix and win versions are not deleted

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1#!perl -w
2
3# bring in the perl module that includes copy
4use File::Copy;
5
6# base name for where we are
7$basename = "c:/projects/cloudy/trunk/";
8
9# the root dir where the unix files will live on my pc
10#$local_unix_source_dir = "c:/projects/cloudy/trunk/unix/source";
11#$local_unix_data_dir = "c:/projects/cloudy/trunk/unix/data";
12$local_unix_data_dir = "$basename"."unix/data";
13
14#$local_unix_main_dir = "c:/projects/cloudy/trunk/unix";
15$local_unix_main_dir = "$basename"."unix";
16
17# this is where the original source files live on my pc
18#$original_source_dir = "c:/projects/cloudy/trunk/source";
19#$original_data_dir =   "c:/projects/cloudy/trunk/data";
20$original_data_dir =   "$basename"."data";
21
22# this is the last source.tar.gz, will compare this time stamp with debug exe
23# and bail if tar file is younger than exe
24#$local_unix_sourcetar = "$local_unix_main_dir"."/source.tar.gz";
25# --------------------------------------------------------------------------
26
27# the root dir where the unix files will live on the linux cluster
28#$cluster_unix_source_dir = "u:/cloudy/trunk/source";
29$cluster_unix_data_dir =   "u:/cloudy/trunk/data";
30
31# this is the ftp site on gradj
32$ftp_last = "u:/pub/gary/bleeding_edge/last/";
33
34# the root dir where the unix files will live on my pc
35#$local_unix_source_dir = "c:/projects/cloudy/trunk/unix/source";
36#$local_unix_data_dir = "c:/projects/cloudy/trunk/unix/data";
37$local_unix_data_dir = "$basename"."unix/data";
38
39#$local_unix_main_dir = "c:/projects/cloudy/trunk/unix";
40$local_unix_main_dir = "$basename"."unix";
41
42# the win dir within the unix set
43#$local_win_source_dir = "c:/projects/cloudy/trunk/win/source";
44#$local_win_data_dir = "c:/projects/cloudy/trunk/win/data";
45$local_win_data_dir = "$basename"."win/data";
46
47#this is where backup files will be dropped
48#$unixhome = "c:/projects/cloudy/trunk/unix";
49$unixhome = "$basename"."unix";
50
51# this block - clean out the target directories so we get fresh copies
52
53# move to pc unix data dir
54chdir( "$local_unix_data_dir" ) or die " invalid unix data directory for data\n";
55print(" moved to unix target data directory, about to delete all files\n");
56# remove the unix data files
57unlink <*> ;
58
59# move to win data dir
60chdir( "$local_win_data_dir" ) or die " invalid win data directory for data\n";
61print(" moved to win target data directory, about to delete all files\n");
62# remove the win data files
63unlink <*> ;
64
65# move to original data directory
66chdir( $original_data_dir ) or die " invalid directory for data\n";
67
68# now do all data files in data dir
69# there is a different set of data files tar'd into data.tar in tsuite/auto, this is done
70# by the autorun.pl script
71$input = "readme_data.htm";
72$output = "$local_unix_data_dir"."/"."readme_data.htm";
73system "dos2unix < $input  > $output" ;
74$output = "$local_win_data_dir"."/"."$input";
75# simply copy the html file here
76copy( $input  , $output );
77
78# treate this as a binary file
79copy( "clouds.jpg" , "$local_unix_data_dir"."/"."clouds.jpg" );
80copy( "clouds.jpg" , "$local_win_data_dir"."/"."clouds.jpg" );
81
82# the tex and pdf file for P van Hoof's writeup on the new grains
83# first do the pdf version as a binary file
84copy( "vanhoof_grain_model.pdf" , "$local_unix_data_dir"."/"."vanhoof_grain_model.pdf" );
85copy( "vanhoof_grain_model.pdf" , "$local_win_data_dir"."/"."vanhoof_grain_model.pdf" );
86# next the tex master document
87$input = "vanhoof_grain_model.tex";
88$output = "$local_unix_data_dir"."/"."vanhoof_grain_model.tex";
89# convert eol for unix version
90system "dos2unix < $input  > $output" ;
91$output = "$local_win_data_dir"."/"."$input";
92# simply copy the file to the win dir
93copy( $input  , $output );
94# next the ps output
95$input = "vanhoof_grain_model.ps";
96$output = "$local_unix_data_dir"."/"."vanhoof_grain_model.ps";
97# convert eol for unix version
98system "dos2unix < $input  > $output" ;
99$output = "$local_win_data_dir"."/"."$input";
100# simply copy the file to the win dir
101copy( $input  , $output );
102
103# copy all data files
104while( defined( $input = glob("*.dat") ) )
105{
106        print( "$input going to " );
107        $output = "$local_unix_data_dir"."/"."$input";
108        print("$output\n");
109        # actually execute the code
110        system "dos2unix < $input  > $output";
111#
112#       now do win version
113        print( "$input going to " );
114        $output = "$local_win_data_dir"."/"."$input";
115        print("$output\n");
116        # simply copy the source here
117        copy( $input  , $output );
118}
119
120# copy all opacity files
121while( defined( $input = glob("*.opc") ) )
122{
123        print( "$input going to " );
124        $output = "$local_unix_data_dir"."/"."$input";
125        print("$output\n");
126        # actually execute the code
127        system "dos2unix < $input  > $output";
128#
129#       now do win version
130        print( "$input going to " );
131        $output = "$local_win_data_dir"."/"."$input";
132        print("$output\n");
133        # simply copy the source here
134        copy( $input  , $output );
135}
136
137# copy all input scripts
138while( defined( $input = glob("*.in") ) )
139{
140        print( "$input going to " );
141        $output = "$local_unix_data_dir"."/"."$input";
142        print("$output\n");
143        # actually execute the code
144        system "dos2unix < $input  > $output";
145#
146#       now do win version
147        print( "$input going to " );
148        $output = "$local_win_data_dir"."/"."$input";
149        print("$output\n");
150        # simply copy the source here
151        copy( $input  , $output );
152}
153
154# copy all ini scripts
155while( defined( $input = glob("*.ini") ) )
156{
157        print( "$input going to " );
158        $output = "$local_unix_data_dir"."/"."$input";
159        print("$output\n");
160        # actually execute the code
161        system "dos2unix < $input  > $output";
162#
163#       now do win version
164        print( "$input going to " );
165        $output = "$local_win_data_dir"."/"."$input";
166        print("$output\n");
167        # simply copy the source here
168        copy( $input  , $output );
169}
170
171# copy all rfi scripts
172while( defined( $input = glob("*.rfi") ) )
173{
174        print( "$input going to " );
175        $output = "$local_unix_data_dir"."/"."$input";
176        print("$output\n");
177        # actually execute the code
178        system "dos2unix < $input  > $output";
179#
180#       now do win version
181        print( "$input going to " );
182        $output = "$local_win_data_dir"."/"."$input";
183        print("$output\n");
184        # simply copy the source here
185        copy( $input  , $output );
186}
187
188# copy all szd scripts
189while( defined( $input = glob("*.szd") ) )
190{
191        print( "$input going to " );
192        $output = "$local_unix_data_dir"."/"."$input";
193        print("$output\n");
194        # actually execute the code
195        system "dos2unix < $input  > $output";
196#
197#       now do win version
198        print( "$input going to " );
199        $output = "$local_win_data_dir"."/"."$input";
200        print("$output\n");
201        # simply copy the source here
202        copy( $input  , $output );
203}
204
205
206print("\n=========================\n");
207print("All data files have been copied to trunk/unix/data subdir\n");
208print("=========================\n");
209
210print( "data, source, tsuite files copied to win and pc unix \n");
211
212# move to pc unix data directory
213if( !chdir( $local_unix_data_dir ) )
214{
215       printf(" invalid directory for local unix data directory\n");
216       exit(1);
217}
218# this loops over all files in the pc unix data directory
219# and copies unix version to subdir unix on cluster, which is now empty
220while( defined( $input = glob("*") ) )
221{
222        print( "$input going to " );
223        $output = "$cluster_unix_data_dir"."/"."$input";
224        print("$output\n");
225        # actually copy the file
226        copy( $input  , $output );
227}
228
229# now zip up the files we created
230if( !chdir( "$unixhome" ) )
231{
232       printf(" invalid unix home directory for unix home\n");
233       exit(1);
234}
235print(" moved to unix home directory\n");
236
237# remove old gzipd file if it exists
238if( -e "data.tar.gz" )
239{
240   unlink("data.tar.gz" );
241}
242
243# ----------------------------------------------------------
244#   tar the files
245
246# tar pc unix data
247if( !chdir( "$local_unix_data_dir" ) )
248{
249       printf(" invalid directory for local data source\n");
250       exit(1);
251}
252$tarfile = "../"."data.tar";
253system "tar -cf $tarfile * ";
254print( "about to gzip $tarfile\n" );
255system "gzip $tarfile ";
256
257# move to main dir so that we can copy tar.gz files to ftp site
258if( !chdir( "$local_unix_main_dir" ) )
259{
260       printf(" invalid directory for main unix\n");
261       exit(1);
262}
263# finally copy the newly created files to the ftp site
264#copy( "source.tar.gz" , "u:/pub/gjf/source.tar.gz" );
265#copy( "data.tar.gz" , "u:/pub/gjf/data.tar.gz" );
266copy( "data.tar.gz" , $ftp_last );
267
268
269# remove old gzipd file if it exists
270if( -e "data.zip" )
271{
272   unlink("data.zip" );
273}
274
275# win data
276system "c:\\u\\wzzip   data.zip $local_win_data_dir ";
277
278# finally copy the newly created files to the ftp site
279copy( "data.zip" , $ftp_last );
280
281# all is finished, copy *.mod, the stellar continua, to local unix data so
282# that gcc can get to it
283system "cp $original_data_dir/*.mod $local_unix_data_dir ";
284
285print("\n=========================\n");
Note: See TracBrowser for help on using the browser.