[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: anonftpsync mail subject



Hi, 

On Wed Sep 12, 2007 at 11:43:57 -0400, Ricardo Yanez wrote:
> Sorry, the subject line should be in "" in the mail command,
> 
>  if ! [ -z $MAILTO ]; then
>           mail -s "$MAIL_SUBJECT" $MAILTO < $LOGFILE
>  fi
> 
> Ricardo
> 
> > I have made a small change to my anonftpsync which I think could be
> > useful to others,
> >
> > [snip]
> > if [ 0 = $result ]; then
> >          # Now sync the remaining stuff
> >          rsync --recursive --links --hard-links --times --verbose
> > --delay-updates --delete-after \
> >               --exclude "Archive-Update-in-Progress-${HOSTNAME}" \
> >               --exclude "project/trace/${HOSTNAME}" \
> >               $TMP_EXCLUDE $EXCLUDE $SOURCE_EXCLUDE \
> >               $RSYNC_HOST::$RSYNC_DIR $TO >> $LOGFILE 2>&1
> >
> >          LANG=C date -u > "${TO}/project/trace/${HOSTNAME}"
> >          MAIL_SUBJECT="debian archive sync successful"
> > else
> >          echo "ERROR: Help, something weird happened" | tee -a $LOGFILE
> >          echo "mirroring /pool exited with exitcode" $result | tee -a
> > $LOGFILE
> >          MAIL_SUBJECT="debian archive sync failed"
> > fi
> >
> >
> > if ! [ -z $MAILTO ]; then
> >          mail -s $MAIL_SUBJECT $MAILTO < $LOGFILE
> > fi
> > [/snip]
> >
> > The subject line will tell you right away if the sync failed or not, and
> > you won't need to scroll down to the end of the log every time.
> >
> > However an improvement, if the second pass failes, the subject line will
> > still say it's a success. A second "result=$?" and an if statement just
> > before the mail is sent may solve this case.

looks sane to me. Simon, may i apply that change?

-- 
[root@debian /root]# man real-life
No manual entry for real-life



Reply to: