--- mitgcm.org/scripts/daily_tarfile 2009/07/10 00:27:16 1.2 +++ mitgcm.org/scripts/daily_tarfile 2018/01/15 19:23:35 1.7 @@ -1,42 +1,54 @@ #! /usr/bin/env bash -# $Header: /home/ubuntu/mnt/e9_copy/mitgcm.org/scripts/daily_tarfile,v 1.2 2009/07/10 00:27:16 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/mitgcm.org/scripts/daily_tarfile,v 1.7 2018/01/15 19:23:35 jmc Exp $ # download the source code and make a tar file -export CVSROOT=/u/gcmpack +#export CVSROOT=/u/gcmpack +#- to allow users to use cvs update/diff on their untar version of the code, +# switch to pserver method (stored everywhere in the tree in dirs CVS/Root) +export CVSROOT=':pserver:cvsanon@mitgcm.org:/u/gcmpack' umask 0002 -echo 'Changing dir. to /u/httpd/html/download/daily_snapshot' -cd /u/httpd/html/download/daily_snapshot +echo 'Changing dir. to /u/u0/httpd/html/download/daily_snapshot' +cd /u/u0/httpd/html/download/daily_snapshot outp=$? if test $outp != 0 ; then echo " Error in cd : $outp" - exit + exit 1 fi test -e MITgcm && rm -rf MITgcm -echo 'Checking out MITgcm...' -cvs co -P MITgcm > /dev/null 2>&1 +echo -n 'Checking out MITgcm ... ' +cvs -q co -P MITgcm > /dev/null +outp=$? +if test $outp = 0 ; then + echo 'Done!' +else + echo " Error in cvs checkout: $outp" + exit 2 +fi #chgrp gcmpack MITgcm #chmod 775 MITgcm -echo 'Creating the tar file...' -rm -rf MITgcm_ss_* +rm -f MITgcm_ss_* tname='MITgcm_ss_'`date +%Y%m%d`'.tar.gz' + +echo -n 'Creating the tar file ... ' tar -czf $tname ./MITgcm +#- should check if successful, it not -> exit 3 +echo 'Done!' + #chmod 664 $tname ls -l $tname -echo 'Done!' - #-- test for new checkpoint cd .. version_file="daily_snapshot/MITgcm/doc/tag-index" -backupDir="other_checkpoints" +backupDir="other_checkpoints" if test -f $version_file ; then - thischkpt=`grep '^checkpoint' $version_file | head -1` + thischkpt=`awk '/^checkpoint/{print $1; exit}' $version_file` short=`echo $thischkpt | sed 's/checkpoint/c/'` chkptar="MITgcm_$short" if test -f $chkptar.tar.gz ; then @@ -44,12 +56,12 @@ else echo -n "Checking out $thischkpt ..." rm -f checkout.out checkout.err - cvs co -P -d $chkptar -r $thischkpt MITgcm 1> checkout.out 2> checkout.err + cvs -q co -P -d $chkptar -r $thischkpt MITgcm 1> checkout.out 2> checkout.err outp=$? if test $outp != 0 ; then echo " Error in cvs checkout: $outp" cat checkout.err - exit + exit 4 fi echo -n " ; making tar file ... " rm -f checkout.out checkout.err @@ -57,7 +69,7 @@ outp=$? if test $outp != 0 ; then echo " Error in tar command: $outp" - exit + exit 5 else echo " Done" rm -r -f $chkptar @@ -70,7 +82,7 @@ for xx in $listTar ; do if test $xx != $chkptar.tar.gz ; then if test -f other_checkpoints/$xx ; then - echo "error: $backupDir/$xx already exist" + echo "error: $backupDir/$xx already exist" else echo " mv $xx $backupDir" mv $xx $backupDir @@ -79,8 +91,7 @@ done else echo " no dir: $backupDir" - exit + exit 6 fi fi fi -