1753587 Members
6813 Online
108796 Solutions
New Discussion юеВ

fbackup return value

 
SOLVED
Go to solution
Koh Kuan Wong
Occasional Contributor

fbackup return value

I am writing a script to do backup and executes other commands.

Is there a way where I can know whether a fbackup process is successful or not? Only if the backup is successful, then only I can proceed to the other commands.

In the man page, I can see that there is this statement :
fbackup returns one of the following values:
0 upon normal completion.
1 if it is interrupted but allowed to save
its state for possible restart.
2 if any error conditions prevent the
session from completing.
4 if any warning conditions are encountered.

If warnings occur, the operator should check the fbackup logs to verify the sanity of the backup.

But, I have looked for the log files and I don't see any of the values mention above.

Thanks.
3 REPLIES 3
Rob Smith
Respected Contributor

Re: fbackup return value

Hi, couple of things. In your script put print $? after the backup. That will give you the return value of the backup job. You can then base whatever you want to do after the backup job on that exit code. Secondly, if you run your backups through sam then the results of the backup are logged in /var/sam/log/br_log. You will see the exit code appended to that file. Hope this helps.

Rob
Learn the rules so you can break them properly.
Michael Tully
Honored Contributor

Re: fbackup return value

Hi,

You must use the -I and -v options to make
sure that logging is done. if the -I is
omitted no logging will occur.

HTH
Michael
Anyone for a Mutiny ?
Magdi KAMAL
Respected Contributor
Solution

Re: fbackup return value

Hi,

The following script could solve your problem :

# fbackup command will backup /users directory
fbackup -f /dev/rmt/0m -i /users

if [[ $? = 0 ]]
then
# fbackup terminates correctly
# Put instructions related to that here
else
# fbackup terminates uncorrectly
# Put instructions related to that here
fi