Operating System - HP-UX
1830939 Members
2870 Online
110017 Solutions
New Discussion

How to capture fbackup return value

 
SOLVED
Go to solution
Kelvin Yu
Advisor

How to capture fbackup return value

Hi,

I am writing a crontab script to do fbackup and at the end I want to alert my pager if the fbackup is successful or else. My log did not show any return code. Did I miss anything?
fbackup command looks like the following
#fbackup -0 -v -g PMgraph -f /dev/rmt/0m I bkuplist -V bkupvolume >fbackup.log

Thanks & any help appreciated.
Kelvin
6 REPLIES 6
Muthukumar_5
Honored Contributor

Re: How to capture fbackup return value

fbackup returns return value as,

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

Collect return type as,
fbackup -0 -v -g PMgraph -f /dev/rmt/0m I bkuplist -V bkupvolume >fbackup.log
returnvalue=$?

see fbackup man page for RETURN VALUE part.

HTH.
Easy to suggest when don't know about the problem!
Muthukumar_5
Honored Contributor

Re: How to capture fbackup return value

Opps. You are piping fbackup output to bkuplist there.

we cannot get fbackup execution return there.
We will be getting only return code of bkuplist there.

what is bkuplist there? It is it a script there.

HTH.
Easy to suggest when don't know about the problem!
Kelvin Yu
Advisor

Re: How to capture fbackup return value

Thanks for helping.

My typo error! The command should be
#fbackup -0 -v -g PMgraph -f /dev/rmt/0m -I bkuplist -V bkupvolume >fbackup.log

bkuplist is only capturing what I am backing up.

I think I can capture the return code by
putting
returnvalue=$?

Thanks.
Kelvin

Kelvin Yu
Advisor

Re: How to capture fbackup return value

Hi,

Is there a way to capture fbackup messages for example:
fbackup(1417): cannot open the dates file /var/adm/fbackupfiles/dates for reading
fbackup(1004): session begins on Thu Oct 21 12:11:30 2004
fbackup(3203): volume 1 has been used 2 time(s)
fbackup(3024): writing volume 1 to the output file /dev/rmt/0m
1: / 2
2: /syb_bkup 4
3: /syb_bkup/abc 1
fbackup(1005): run time: 31 seconds
fbackup(3055): total file blocks read for backup: 7
fbackup(3056): total blocks written to output file /dev/rmt/0m: 31

I would like to see those fbackup(xxxx) messages recorded in my log file. How?

Thanks,
Kelvin
Muthukumar_5
Honored Contributor
Solution

Re: How to capture fbackup return value

We can monitory all fbackup output and error information to a log file then,

# Start script
script /tmp/fbackup.log

# Fbackup
fbackup -0 -v -g PMgraph -f /dev/rmt/0m -l bkuplist -V bkupvolume

# Return code
ret=$?

# Script command exit
exit

Else, you can tee command as,

fbackup -0 -v -g PMgraph -f /dev/rmt/0m -l bkuplist -V bkupvolume | tee fbackup.log

Or simply, you can use as,
fbackup -0 -v -g PMgraph -f /dev/rmt/0m -l bkuplist -V bkupvolume 1>fbackup.log 2>&1

1>fbackup.log 2>&1 redirects all STDOUT / STDERR mode informations to that fbackuplog file.

HTH.

Easy to suggest when don't know about the problem!
Kelvin Yu
Advisor

Re: How to capture fbackup return value

Hi Muthukumar,

Thanks so much. My problems resolved.

Regards,
Kelvin