From: "Jody Cleveland" <Cleveland@xxxxxxxxxxxx> > Hi Ben, > > > > Just append "&& echo SUCCESS", or something to that effect > > to the end of > > > that line. It only echoes upon success of the previous command. > > > > > > > Thanks, Jason! I hadn't known about the && or || in shell > > scripting, but > > your comment helped me to find them in the bash man page. > > Very cool stuff! > > I've got my script working well and it's now sending me an > > email with the > > status report for the nightly backup. > > What did you end up putting at the end? I tried && echo SUCCESS and it > gave me an error. I'm looking to do the same you are, with the results > emailed to me. > > Thanks for any help you can provide. Well, I did it a bit differently. I'm sure that one of the shell guru's could have done this better, but this has been tested and seems to work for us: (Note: because of word-wrap, I put a copy of the script at: http://www.benjamin.weiss.name/backup.txt .) ----------------------------- #!/bin/bash # bash shell script to do a full backup to tape # 21 January 2004 - Benjamin J. Weiss # # This script does a full backup of non-temporary filesystems, # then rewinds the tape. # # Options below: # -O : Do a backup, not a verify. # F : Do not ask to make a boot floppy # t : Backup to tape # d /dev/st0 : Use the tape device and rewind after backup (nst0 would not rewind) # -l GRUB : The bootloader that we're using # -f /dev/sda : The drive that the boot loader is on # -E "path" : Directories to exclude from the backp. # # modified path so that mondoarchive can find mindi, etc PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin # # modify EMAIL to the reporting address EMAIL=person@xxxxxxxxxxx # RESULT=failure # DATE=`date` # # /usr/local/bin/mondoarchive -OFtd /dev/st0 -l GRUB -f /dev/sda -E "/tmp /dev /mnt /proc" && RESULT=success # TEXT="orion backup for $DATE status: $RESULT" # echo $TEXT > /tmp/orion-backup # mutt -s "$TEXT" $EMAIL < /tmp/orion-backup # rm -f /tmp/orion-backup # # set path back to what cron expects PATH=/sbin:/bin:/usr/sbin:/usr/bin # -- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list