| 1 |
#! /usr/bin/env bash |
| 2 |
|
| 3 |
# $Header: /u/gcmpack/mitgcm.org/scripts/daily_update,v 1.5 2018/01/29 20:36:59 jmc Exp $ |
| 4 |
|
| 5 |
# Run in: ~/testing/ to update several dir. which are used for: |
| 6 |
# - front_page building |
| 7 |
# - processing testing emails (-> testing page, part of front_page building) |
| 8 |
# - making a daily tar file of source code |
| 9 |
|
| 10 |
export CVS_RSH=ssh |
| 11 |
export CVSROOT=':ext:jmc@mitgcm.org:/u/gcmpack' |
| 12 |
|
| 13 |
#- update scripts dir: |
| 14 |
if test -d scripts ; then |
| 15 |
echo -n 'Update dir: ' |
| 16 |
( cd scripts && pwd && cvs -q update -P -d ) |
| 17 |
fi |
| 18 |
|
| 19 |
#- update ref_machine testing scripts: |
| 20 |
if test -d ref_machine ; then |
| 21 |
echo -n 'Update dir: ' |
| 22 |
( cd ref_machine && pwd && cvs -q update -P -d ) |
| 23 |
fi |
| 24 |
|
| 25 |
#-- update tools/mpack-1.6 dir: |
| 26 |
# if test -d tools_mpack ; then |
| 27 |
# echo -n 'Update dir: ' |
| 28 |
# tmpFil=/tmp/TTT.daily_snapshot.$$ |
| 29 |
# exe=munpack |
| 30 |
# ( cd tools_mpack ; pwd |
| 31 |
# chg=`cvs -q update -P -d | tee $tmpFil | sed '/^?/d' | wc -l` |
| 32 |
# #echo "chg ='$chg'" |
| 33 |
# cat $tmpFil ; rm -f $tmpFil |
| 34 |
# if test "x$chg" != x0 ; then |
| 35 |
# if test -f $exe ; then echo " removing: $exe force re-build." ; fi |
| 36 |
# rm -f $exe |
| 37 |
# fi |
| 38 |
# ) |
| 39 |
# fi |
| 40 |
|
| 41 |
#- update front-page building dir: |
| 42 |
if test -d front_content ; then |
| 43 |
echo -n 'Update dir: ' |
| 44 |
( cd front_content && pwd && cvs -q update -P -d ) |
| 45 |
fi |
| 46 |
|
| 47 |
#-- clean-up old log files: |
| 48 |
cd logs |
| 49 |
n=$(( `ls bld_manual.* 2>/dev/null | wc -l` - 10 )) |
| 50 |
if test $n -gt 0 ; then |
| 51 |
echo -n ' remove files: ' |
| 52 |
ls -lt bld_manual.* | tail -"$n" |
| 53 |
ls -t bld_manual.* | tail -"$n" | xargs rm -f |
| 54 |
fi |
| 55 |
p=`ls check_outp_*.txt_bak 2>/dev/null | wc -l` |
| 56 |
n=$(( `ls check_outp_*.txt 2>/dev/null | wc -l` - 15 )) |
| 57 |
if test $p -gt 0 -o $n -gt 0 ; then echo -n ' remove files: ' ; fi |
| 58 |
if test $p -gt 0 ; then |
| 59 |
ls check_outp_*.txt_bak |
| 60 |
rm -f check_outp_*.txt_bak |
| 61 |
fi |
| 62 |
if test $n -gt 0 ; then |
| 63 |
ls -lt check_outp_*.txt | tail -"$n" |
| 64 |
ls -t check_outp_*.txt | tail -"$n" | xargs rm -f |
| 65 |
fi |