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 |
# download or 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 |
|
42 |
|
43 |
umask 0002 |
44 |
|
45 |
echo 'Changing directory to /u/httpd/html/download/daily_snapshot' |
46 |
cd /u/httpd/html/download/daily_snapshot |
47 |
test -e MITgcm && rm -rf MITgcm |
48 |
|
49 |
echo 'Checking out MITgcm...' |
50 |
cvs co -P MITgcm > /dev/null 2>&1 |
51 |
#chgrp gcmpack MITgcm |
52 |
#chmod 775 MITgcm |
53 |
|
54 |
echo 'Creating the tar file...' |
55 |
rm -rf MITgcm_ss_* |
56 |
tname='MITgcm_ss_'`date +%Y%m%d`'.tar.gz' |
57 |
tar -czf $tname ./MITgcm |
58 |
#chmod 664 $tname |
59 |
ls -l $tname |
60 |
|
61 |
echo 'Done!' |