Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Postscript for backup still activated when backup fails.

Status
Not open for further replies.

leno

Technical User
Apr 11, 2005
5
SG
Hi gurus,

I am currently using legato 7.1.2.

I am trying to backup a unix server and by means of savepmpc, I created shell scripts for prebackup , ostbackup.

The idea is to copy the data for backup to a temp directory (prebackup) and from there I will proceed with the backup and finally when the backup is finished, the script postbackup will delete the data from the temp folders.

The scripts run perfectly when the backup runs successfully, but I discovered something :in case backup fails, the post script will still be activated.

Is there anyway to prevent the post script from runing once an error in backup is detected?

My prebackup script:
touch /windata/backup/start_prebackup_script
mkdir /windata/backup/ade
mkdir /windata/backup/ade/ade-bin
mkdir /windata/backup/ade/ade-sam
mkdir /windata/backup/ade/epi
mkdir /windata/backup/ade/lotting
mkdir /windata/backup/ade/mws
cd /nfsdata/ade/dat
find ade-bin/ -name \* -mtime +149 -exec cp {} /windata/backup/ade/{} \;
find ade-sam/ -name \* -mtime +149 -exec cp {} /windata/backup/ade/{} \;
find epi/ -name \* -mtime +149 -exec cp {} /windata/backup/ade/{} \;
find lotting/ -name \* -mtime +149 -exec cp {} /windata/backup/ade/{} \;
find mws/ -name \* -mtime +149 -exec cp {} /windata/backup/ade/{} \;
touch /windata/backup/begin_actual_backup
exit 0

My postbackup script
cd /windata/backup
rm * -f -r
touch BackupComplete

Any advise will be appreciated.
Thanks.

But when simulation, abort backup -> the post command is activated.
 
You could put some checks in, say use mminfo to find the tapes used by the backup and the ssflags option could give an indication of failure, then you an if loop to just omit the steps of the post script.

Just an idea, you would have to play around a bit.

I notice in your script above you have a rm * -f -r, I would avoid this and use rm -r /windata/backup.
If something happened to the /windaya/backup directory then the cd command would fail, but the rm command would work and delete whatever is in in the directory that it is active on, food for thought, I never use rm * in a script, too dangerous.

Martin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top