Guys, I'm trying to write a bash script to do a nightly back up of a server
to an external hard drive. I've pretty much got most of it functioning, and
here is pretty much the line that does the actual work:
echo tar -czf $BACKUPTO/backup-$TODAY.tgz $BACKUPFROM
backupto is where it backs up to, today is a yymmdd formatted date, and
backupfrom is the directory TO back up.
I've got it set up to then delete any files over 2 weeks old...but I might
change that time span once I determine just how much space is
needed/available.
The functionality I'm wanting to add to it, is after the TAR/GZIP operation,
I want it to know if the tar command completed successfully or with errors.
If there were errors, then skip the deletion process. The skipping part is
easy, but I guess the main thing I'm wondering is how do I test whether the
tar command ran successfully? I remember in DOS, after you run a command,
you can test it with "IF ERRORLEVEL=0" and if that returns true then you
know the command completed successfully. What's the unix equivalent?
___________________
Nolug mailing list
nolug@nolug.org
Received on 06/22/07
This archive was generated by hypermail 2.2.0 : 12/19/08 EST