Changeset 27541

Show
Ignore:
Timestamp:
04.06.2013 19:35:21 (6 years ago)
Author:
ak19
Message:

Message being mailed now includes the html version of the report as an attachment. I can't yet work out why the mutt command can't send the version of the mail with attachment to greenstone mail (the command doesn't work from the command line either), although it can send the attachment to my own uni id. It's also possible to send the plain message without attachment to the greenstone id. Maybe the greenstone mail id has been set to block messages with attachments sent from linux mutt commands?

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • other-projects/nightly-tasks/diffcol/trunk/task

    r27540 r27541  
    217217    echo "</test>" >> $xmlout 
    218218 
    219     # email out if failed 
    220     echo "Checking if failed... " 
    221     result=`java org.apache.xalan.xslt.Process -IN "$xmlout" -XSL "$TASK_HOME/xsl/passed-or-not.xsl"` 
    222     echo "result: "$result 
    223     if [ "$result" != "yes" ]; then 
    224         echo 'gsdl regression test for '$dateid' failed' | mail -s $1' Regression Test Failed' $MONITOR_EMAIL 
    225         #$WEBMASTER_EMAIL 
    226     fi 
    227     echo "done" 
     219    echo "done" 
     220 
    228221} 
    229222 
     
    231224    # ensure the upload directory exists  
    232225    # before trying to transfer the xml and html files across 
     226    # if it already existed, clear it of contents 
    233227    if [ ! -d "$UPLOAD_DIR" ]; then 
    234228    mkdir -p "$UPLOAD_DIR"; 
     229#    else 
     230#   rm $UPLOAD_DIR/* 
    235231    fi 
    236232 
    237233    scp $DATA_DIR/*.xml $DATA_DIR/*.html $UPLOAD_DIR 
     234} 
     235 
     236function mail_simple_message() { 
     237    # email out brief failure message if failed                                                        
     238    echo "Checking if failed... " 
     239    result=`java org.apache.xalan.xslt.Process -IN "$xmlout" -XSL "$TASK_HOME/xsl/passed-or-not.xsl"` 
     240    echo "result: "$result 
     241    if [ "$result" != "yes" ]; then 
     242        echo 'gsdl regression test for '$dateid' failed' | mail -s 'Regression Test Failed' $MONITOR_EMAIL #$WEBMASTER_EMAIL  
     243    fi 
     244} 
     245 
     246 
     247function mail_with_report_attached() { 
     248    # http://stackoverflow.com/questions/17359/how-do-i-send-a-file-as-an-email-attachment-using-linux-command-line 
     249 
     250    #echo "This is the message body" | mutt -a "/path/to/file.to.attach" -s "subject of message" -- recipient@domain.com 
     251 
     252 
     253    # email out with report attached, if the tests failed                                                       
     254    echo "Checking if failed... " 
     255    result=`java org.apache.xalan.xslt.Process -IN "$xmlout" -XSL "$TASK_HOME/x\ 
     256sl/passed-or-not.xsl"` 
     257    echo "result: "$result 
     258    if [ "$result" != "yes" ]; then 
     259    echo 'gsdl regression test for '$dateid' failed' | mutt -a $DATA_DIR'/report-'$dateid'.html' -s 'Regression Test Failed' -- $MONITOR_EMAIL 
     260    fi 
     261    echo "Sent mail with report attached." 
    238262} 
    239263 
     
    277301elif [ "$action" == "run_test" ]; then 
    278302    run_test 
     303#   mail_simple_message 
    279304elif [ "$action" == "summarise" ]; then 
    280305    summarise 
    281306elif [ "$action" == "upload" ]; then 
    282307    upload 
     308    mail_simple_message 
     309    mail_with_report_attached 
    283310elif [ "$action" == "all" ]; then 
    284311    setup_greenstone 
     
    286313    summarise 
    287314    upload 
    288 fi 
    289  
     315    mail_with_report_attached 
     316fi 
     317