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

Contents of /mitgcm.org/scripts/daily_tarfile

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


Revision 1.6 - (show annotations) (download)
Thu Dec 8 14:35:27 2016 UTC (7 years, 2 months ago) by jmc
Branch: MAIN
Changes since 1.5: +6 -3 lines
add few comments

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

  ViewVC Help
Powered by ViewVC 1.1.22