/[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.7 - (hide annotations) (download)
Mon Jan 15 19:23:35 2018 UTC (6 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +23 -15 lines
- check for successful checkoutp (daily tarfile)
- improve report (use cvs -q for checkout)

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

  ViewVC Help
Powered by ViewVC 1.1.22