| 1 | #! /usr/bin/env bash | 
| 2 |  | 
| 3 | # $Header: /u/gcmpack/mitgcm.org/scripts/prc_tr_emails,v 1.1 2018/01/03 23:19:50 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/jm_c/testing/tools_mpack/munpack | 
| 14 | if test ! -x $unpck ; then | 
| 15 | MPACKDIR=`dirname $unpck` | 
| 16 | cd $MPACKDIR | 
| 17 | ./configure && make | 
| 18 | fi | 
| 19 |  | 
| 20 | #-- create a daily log file (if not already there) | 
| 21 | cd /home/jm_c/testing/logs | 
| 22 | logpfx="prc_emails_" ; sfx=`date +%m%d` | 
| 23 | logfile="../logs/${logpfx}$sfx" | 
| 24 | if test -e $logfile ; then : | 
| 25 | else | 
| 26 | #-- clean-up old log files: | 
| 27 | echo -n '-- in dir: ' ; pwd | 
| 28 | n=$(( `ls ${logpfx}* | wc -l` - 10 )) | 
| 29 | if test $n -gt 0 ; then | 
| 30 | echo -n ' remove files: ' | 
| 31 | ls -lt ${logpfx}* | tail -"$n" | 
| 32 | ls -t  ${logpfx}* | tail -"$n" | xargs rm -f | 
| 33 | fi | 
| 34 | echo ' create new log file:' $logfile | 
| 35 | touch $logfile | 
| 36 | echo "This log file was created by:" `hostname` " on:" `date` >> $logfile | 
| 37 | fi | 
| 38 |  | 
| 39 | #-- get and parse emails : | 
| 40 | cd /home/jm_c/testing/front_content && ./get+parse_msg -u $unpck -a jmc@ocean.mit.edu >> $logfile 2>&1 | 
| 41 | #cd /home/jm_c/testing/temp && ./get+parse_msg -u $unpck -a jmc@ocean.mit.edu >> $logfile 2>&1 |