/[MITgcm]/mitgcm.org/scripts/daily_tarfile
ViewVC logotype

Annotation of /mitgcm.org/scripts/daily_tarfile

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (hide annotations) (download)
Mon Nov 30 21:47:10 2009 UTC (14 years, 2 months ago) by jmc
Branch: MAIN
Changes since 1.2: +2 -2 lines
refine checkpoint finding

1 jmc 1.1 #! /usr/bin/env bash
2    
3 jmc 1.3 # $Header: /u/gcmpack/mitgcm.org/scripts/daily_tarfile,v 1.2 2009/07/10 00:27:16 jmc Exp $
4 jmc 1.1
5     # download the source code and make a tar file
6    
7     export CVSROOT=/u/gcmpack
8    
9     umask 0002
10    
11     echo 'Changing dir. to /u/httpd/html/download/daily_snapshot'
12     cd /u/httpd/html/download/daily_snapshot
13 jmc 1.2 outp=$?
14     if test $outp != 0 ; then
15     echo " Error in cd : $outp"
16     exit
17     fi
18 jmc 1.1 test -e MITgcm && rm -rf MITgcm
19    
20     echo 'Checking out MITgcm...'
21     cvs co -P MITgcm > /dev/null 2>&1
22     #chgrp gcmpack MITgcm
23     #chmod 775 MITgcm
24    
25     echo 'Creating the tar file...'
26     rm -rf MITgcm_ss_*
27     tname='MITgcm_ss_'`date +%Y%m%d`'.tar.gz'
28     tar -czf $tname ./MITgcm
29     #chmod 664 $tname
30     ls -l $tname
31    
32     echo 'Done!'
33    
34 jmc 1.2 #-- test for new checkpoint
35     cd ..
36     version_file="daily_snapshot/MITgcm/doc/tag-index"
37     backupDir="other_checkpoints"
38     if test -f $version_file ; then
39 jmc 1.3 thischkpt=`awk '/^checkpoint/{print $1; exit}' $version_file`
40 jmc 1.2 short=`echo $thischkpt | sed 's/checkpoint/c/'`
41     chkptar="MITgcm_$short"
42     if test -f $chkptar.tar.gz ; then
43     echo "tar file ($chkptar) exist for current tag: $thischkpt"
44     else
45     echo -n "Checking out $thischkpt ..."
46     rm -f checkout.out checkout.err
47     cvs co -P -d $chkptar -r $thischkpt MITgcm 1> checkout.out 2> checkout.err
48     outp=$?
49     if test $outp != 0 ; then
50     echo " Error in cvs checkout: $outp"
51     cat checkout.err
52     exit
53     fi
54     echo -n " ; making tar file ... "
55     rm -f checkout.out checkout.err
56     tar -cf $chkptar.tar $chkptar
57     outp=$?
58     if test $outp != 0 ; then
59     echo " Error in tar command: $outp"
60     exit
61     else
62     echo " Done"
63     rm -r -f $chkptar
64     fi
65     gzip $chkptar.tar
66     ls -l $chkptar.tar*
67     #-- move previous tar file to backupDir
68     listTar=`ls MITgcm_c*.tar.gz`
69     if test -d $backupDir ; then
70     for xx in $listTar ; do
71     if test $xx != $chkptar.tar.gz ; then
72     if test -f other_checkpoints/$xx ; then
73     echo "error: $backupDir/$xx already exist"
74     else
75     echo " mv $xx $backupDir"
76     mv $xx $backupDir
77     fi
78     fi
79     done
80     else
81     echo " no dir: $backupDir"
82     exit
83     fi
84     fi
85     fi
86    

  ViewVC Help
Powered by ViewVC 1.1.22