On Thu, Jan 20, 2011 at 2:23 PM, Richard Pieri <richard.pi...@gmail.com>wrote:

> On Jan 20, 2011, at 2:02 PM, stephen goldman wrote:
> >
> > Hello All,
> >    I'm looking for a better way to work tape jobs. Seek input from
> others..
> >
> >    The goal is to put the job in the background and receive an email when
> the job is complete.
>
> I think that you're on the right track but you don't put the tar in the
> background.  If you do that then you will need a second process watching for
> the first to complete.  What you really want to do is put a little shell
> script around the tar job, have it do the mailing, and background that.
>  Something like:
>
> #!/bin/sh
> tar -cvf /dev/nst0 files > /tmp/tar.log
> mail -s "Backup for `date`" sgold...@mit.edu < /tmp/tar.log
>
> --Rich P.
>
>
> _______________________________________________
> Discuss mailing list
> Discuss@blu.org
> http://lists.blu.org/mailman/listinfo/discuss
>

You could take this a bit further and have it let you know in the subject if
it succeeded or not.

#!/bin/bash
tar -cvf /dev/nst0 files > /tmp/tar.log
if [ "$?" -ne "0" ]; then
  mail -s "Backup failed for `date`" sgold...@mit.edu < /tmp/tar.log
  exit 1
fi
mail -s "Backup succeeded for `date`" sgold...@mit.edu < /tmp/tar.log




-matt
_______________________________________________
Discuss mailing list
Discuss@blu.org
http://lists.blu.org/mailman/listinfo/discuss

Reply via email to