1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/gcmpack/mitgcm.org/scripts/daily_snapshot,v 1.3 2008/03/05 00:56:11 jmc Exp $ |
4 |
|
5 |
# 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 CVSROOT=/u/gcmpack |
11 |
|
12 |
#- update scripts with explicit path: |
13 |
echo -n 'Update dir:' |
14 |
cd /u/u2/jmc/testing/scripts && pwd && cvs -q update -P -d |
15 |
|
16 |
#-- update tools/mpack-1.6 dir : |
17 |
tmpFil=/tmp/TTT.daily_snapshot.$$ |
18 |
exe=munpack |
19 |
cd /u/u2/jmc/testing/tools_mpack |
20 |
echo -n 'Update dir:' ; pwd |
21 |
chg=`cvs -q update -P -d | tee $tmpFil | sed '/^?/d' | wc -l` |
22 |
#echo "chg ='$chg'" |
23 |
cat $tmpFil ; rm -f $tmpFil |
24 |
if test "x$chg" != x0 ; then |
25 |
if test -f $exe ; then echo " removing: $exe force re-build." ; fi |
26 |
rm -f $exe |
27 |
fi |
28 |
|
29 |
#- update front-page building dir: |
30 |
echo -n 'Update dir:' |
31 |
cd /u/u2/jmc/testing/front_content && pwd && cvs -q update -P -d |
32 |
|
33 |
#-- clean-up old log files: |
34 |
cd /u/u2/jmc/testing/logs |
35 |
n=$(( `ls bld_manual.* | wc -l` - 10 )) |
36 |
if test $n -gt 0 ; then |
37 |
echo -n ' remove files: ' |
38 |
ls -lt bld_manual.* | tail -"$n" |
39 |
ls -t bld_manual.* | tail -"$n" | xargs rm -f |
40 |
fi |
41 |
p=`ls check_outp_*.txt_bak | wc -l` |
42 |
n=$(( `ls check_outp_*.txt | wc -l` - 15 )) |
43 |
if test $p -gt 0 -o $n -gt 0 ; then echo -n ' remove files: ' ; fi |
44 |
if test $p -gt 0 ; then |
45 |
ls check_outp_*.txt_bak |
46 |
rm -f check_outp_*.txt_bak |
47 |
fi |
48 |
if test $n -gt 0 ; then |
49 |
ls -lt check_outp_*.txt | tail -"$n" |
50 |
ls -t check_outp_*.txt | tail -"$n" | xargs rm -f |
51 |
fi |