Hi,
I have just created this patch, which adds an option to mail back
reports to the user at his/her desire e-mail address after runltp is
complete. Please test this patch and provide your comments.
--Subrata--
--- ltp-full-20071031/runltp.original 2007-11-26 15:33:43.000000000 +0530
+++ ltp-full-20071031/runltp 2007-11-26 17:55:53.000000000 +0530
@@ -161,6 +161,7 @@ main()
local ALT_DIR_OUT=0
local ALT_DIR_RES=0
local ALT_HTML_OUT=0
+ local ALT_EMAIL_OUT=0
local RUN_NETEST=0
local QUIET_MODE=""
local VERBOSE_MODE=""
@@ -175,13 +176,16 @@ main()
local OUTPUTFILE=""
local HTMLFILE_NAME=""
local HTMLFILE=""
+ local EMAIL_TO=""
local SCENFILES=""
local TAG_RESTRICT_STRING=""
local PAN_COMMAND=""
version_date=`head -n 1 $LTPROOT/ChangeLog`
- while getopts c:C:d:D:f:ehi:g:l:m:Nno:pqr:s:t:vw:x: arg
+ while getopts a:c:C:d:D:f:ehi:g:l:m:Nno:pqr:s:t:vw:x: arg
do case $arg in
+ a) EMAIL_TO=$(($OPTARG))
+ ALT_EMAIL_OUT=1;;
c)
NUM_PROCS=$(($OPTARG))
if [ "$NUM_PROCS" -eq 0 ]; then
@@ -387,7 +391,7 @@ main()
if [ ! "$OUTPUTFILE" ]; then ## User has not mentioned about the Outputfile name, then we need to definitely generate one
OUTPUTFILE_NAME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
OUTPUTFILE="-o $LTPROOT/output/LTP_RUN_ON-$OUTPUTFILE_NAME.output"
-
+ ALT_DIR_OUT=1
if [ ! "$HTMLFILE" ] ; then ## User has not mentioned HTML File name, We need to create one
HTMLFILE_NAME=`basename $OUTPUTFILE_NAME`
HTMLFILE="$LTPROOT/output/$HTMLFILE_NAME.html"
@@ -621,6 +625,61 @@ main()
fi
+ if [ "$ALT_EMAIL_OUT" -eq 1 ] ; then ## User wants reports to be e-mailed
+ if [ ! "$HTMLFILE_NAME" -o ! "$OUTPUTFILE_NAME" -o ! "$LOGFILE_NAME" ]; then
+ ##User does not have output/logs/html-output, nothing to be mailed in this situation
+ echo "Nothing to be mailed here...."
+ break
+ fi
+ TAR_FILE_NAME=LTP_RUN_$version_date`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`.tar
+ if [ "$HTMLFILE_NAME" ] ; then ## HTML file Exists
+ if [ "$ALT_HTML_OUT" -ne 1 ] ; then ## The HTML file path is absolute and not $LTPROOT/output
+ mkdir -p $LTPROOT/output ## We need to create this Directory
+ cp $HTMLFILE_NAME $LTPROOT/output/
+ fi
+ fi
+ if [ "$OUTPUTFILE_NAME" ] ; then ## Output file exists
+ if [ "$ALT_DIR_OUT" -ne 1 ] ; then ## The Output file path is absolute and not $LTPROOT/output
+ mkdir -p $LTPROOT/output ## We need to create this Directory
+ cp $OUTPUTFILE_NAME $LTPROOT/output/
+ fi
+ fi
+ if [ "$LOGFILE_NAME" ] ; then ## Log file exists
+ if [ "$ALT_DIR_RES" -ne 1 ] ; then ## The Log file path is absolute and not $LTPROOT/results
+ mkdir -p $LTPROOT/results ## We need to create this Directory
+ cp $LOGFILE_NAME $LTPROOT/results/
+ fi
+ fi
+ if [ -d $LTPROOT/output ] ; then
+ tar -uvf $TAR_FILE_NAME $LTPROOT/output
+ fi
+ if [ -d $LTPROOT/results ] ; then
+ tar -uvf $TAR_FILE_NAME $LTPROOT/results
+ fi
+ if [ -e $LTPROOT/nohup.out ] ; then ## If User would have Chosen nohup to do ltprun
+ tar -uvf $TAR_FILE_NAME $LTPROOT/nohup.out
+ fi
+ gzip $TAR_FILE_NAME ## gzip this guy
+ if [ -e /usr/bin/mutt ] ; then ## This is a better mail client than others
+ echo "Starting mailing reports to: $EMAIL_TO"
+ mutt -a $TAR_FILE_NAME.gz -c [EMAIL PROTECTED] -s "LTP Reports on $test_start_time" $EMAIL_TO < /dev/null
+ if [ $? -eq 0 ]; then
+ echo "Reports Successfully mailed to: $EMAIL_TO"
+ else
+ echo "Reports cannot be mailed to: $EMAIL_TO"
+ fi
+ else ## Use our Ageold mail program
+ echo "Starting mailing reports to: $EMAIL_TO"
+ uuencode $TAR_FILE_NAME.gz $TAR_FILE_NAME.gz | mail $EMAIL_TO -c [EMAIL PROTECTED] -s "LTP Reports on $test_start_time"
+ if [ $? -eq 0 ]; then
+ echo "Reports Successfully mailed to: $EMAIL_TO"
+ else
+ echo "Reports cannot be mailed to: $EMAIL_TO"
+ fi
+ fi
+ fi
+
+
[ ! -z "$QUIET_MODE" ] && { echo "INFO: Test end time: $(date)" ; }
[ "$GENLOAD" -eq 1 ] && { killall -9 genload >/dev/null 2>&1; }
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list