- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Testing the exit code of fbackup in a script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-20-2001 10:58 AM
тАО08-20-2001 10:58 AM
Testing the exit code of fbackup in a script
I have a somewhat risky operation (resizing hashed files) that needs to be run once a week in the middle of the night. I only want the job to run if I can confirm that I got a good backup and there were no problems...
SO, what I would like to do is cron a script that checks the exit code of the fbackup job, and if it was 4 or less, then go ahead and do the file resizing... If the exit code from fbackup was 5 that means the backup had fatal errors, and in that case I wouldn't want to do the resize....
The logic seems simple, the only problem is that my scripting skills are pretty limited... Can anyway get me going in the right direction?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-20-2001 11:16 AM
тАО08-20-2001 11:16 AM
Re: Testing the exit code of fbackup in a script
Here is what you can do
set LOGFILE = /usr/adm/fbackupfiles/fbackup.log (you can set this file whereever you want)
set FBACKUP = /usr/sbin/fbackup
set GRAPH = /usr/adm/fbackupfiles/graphs/usr-usrlib (if you want to use graph file, else you can use i=include and e=exclusde )
set TEE = /bin/tee
set LEVEL = ?0? is you are doing level0 backup
#If you are not using graph file then you don?t need option g.
#If you are doing level0 backup everyday for say file system /usr then it should look like this
#( $FBACKUP ?0u ?i /usr ?f /dev/rmt/0m; echo; echo "fbackup Exit Status $status" ) |& $TEE -a $LOGFILE
( $FBACKUP -${LEVEL}ug $GRAPH -f $DEVICE; sleep 5;echo; echo "fbackup Exit Status $status" ) |& \ $TEE -a $LOGFILE
set RESULT = `tail -1 $LOGFILE | awk '{print $4}'`
if ( $RESULT == "0" ) then
echo "" >> $LOGFILE
echo "Successful Backup of $SYSTEM" >> $LOGFILE
#/bin/clear
echo ""
echo " *****************************"
echo " * *"
echo " * DONE *"
echo " * *"
echo " *****************************"
else
echo ? FAIL ?
endif
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-20-2001 11:21 AM
тАО08-20-2001 11:21 AM
Re: Testing the exit code of fbackup in a script
fbackup ...............
if [[ $? -le 4 ]] ; then
Backup OK. Commands to do whatever ...
else
Backup failed; Do whatever...
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2001 09:11 AM
тАО08-22-2001 09:11 AM
Re: Testing the exit code of fbackup in a script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2001 09:24 AM
тАО08-22-2001 09:24 AM
Re: Testing the exit code of fbackup in a script
even if overall backup succeeded it might still be possible that the file you want to process was not successfully dumped!
Please note that Sachin's script is a C shell script and has to be executed by /usr/bin/csh.
good luck,
Thierry.