1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/gcmpack/mitgcm.org/scripts/prc_tr_emails,v 1.5 2018/01/12 15:51:57 jmc Exp $ |
4 |
|
5 |
#cat <<EOF |
6 |
#========================================================== |
7 |
#Parsing MITgcm testing emails : |
8 |
#========================================================== |
9 |
# |
10 |
#EOF |
11 |
|
12 |
#-- build munpack if needed: |
13 |
unpck=$HOME/testing/tools_mpack/munpack |
14 |
if test ! -x $unpck ; then |
15 |
MPACKDIR=`dirname $unpck` |
16 |
cd $MPACKDIR |
17 |
./configure && make |
18 |
fi |
19 |
mTyp=`echo $HOSTTYPE | sed 's/-.*$//'` |
20 |
unpck=$HOME/testing/munpack.$mTyp |
21 |
#ls -l $unpck |
22 |
|
23 |
#-- create a daily log file (if not already there) |
24 |
cd $HOME/testing/logs |
25 |
logpfx="prc_emails_" ; sfx=`date +%m%d` |
26 |
logfile="../logs/${logpfx}$sfx" |
27 |
if test -e $logfile ; then : |
28 |
else |
29 |
#-- clean-up old log files: |
30 |
echo -n '-- in dir: ' ; pwd |
31 |
n=$(( `ls ${logpfx}* | wc -l` - 10 )) |
32 |
if test $n -gt 0 ; then |
33 |
echo -n ' remove files: ' |
34 |
ls -lt ${logpfx}* | tail -"$n" |
35 |
ls -t ${logpfx}* | tail -"$n" | xargs rm -f |
36 |
fi |
37 |
echo ' create new log file:' $logfile |
38 |
touch $logfile |
39 |
echo "Log file created from '"`hostname`"' by '$USER' on:" `date` >> $logfile |
40 |
fi |
41 |
|
42 |
#-- get and parse emails : |
43 |
cd $HOME/testing/front_content && ./get+parse_msg -u $unpck -a jmc@ocean.mit.edu >> $logfile 2>&1 |
44 |
#cd $HOME/testing/temp && ./get+parse_msg -u $unpck -a jmc@ocean.mit.edu >> $logfile 2>&1 |