- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: fbackup returncode with a pipe
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
Forums
Discussions
Discussions
Discussions
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
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
06-14-2001 01:15 AM
06-14-2001 01:15 AM
What am I doing?
fbackup
After completion of fbackup I want to know the returncode of fbackup.
Thanks so far.
Wessel
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2001 01:31 AM
06-14-2001 01:31 AM
Re: fbackup returncode with a pipe
Instead of doing fbackup | tee
you can do;
#!/bin/sh
exec 1>
fbackup ....
echo $?
Now you can still get full log output to logfile and still pick up and process the return code from fbackup.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2001 01:50 AM
06-14-2001 01:50 AM
Re: fbackup returncode with a pipe
I'll do a script like this:
exec 1 > /tmp/logfile 2>&1
fbackup ....................
echo $?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2001 03:42 AM
06-14-2001 03:42 AM
Re: fbackup returncode with a pipe
this is not what I'm looking for.
I like to the output of fbackup on screen, so I can see the progress of fbackup, therefore I use -v switch and at the same time I want to log every fbackup-message.
And after fbackup has finished I want to test the returncode of fbackup.
If returncode is not equal to zero I want to look in the logfile for "serious" messages.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2001 04:03 AM
06-14-2001 04:03 AM
Re: fbackup returncode with a pipe
You CAN achieve exactly what you are seeking by using the scheme below. For simplicity, I have placed elipses ("...") in place of the options to 'fbackup':
# ( fbackup ... 2>&1 ; echo $? > /tmp/fb.xit ) | tee -ia /tmp/fb.log
# EXITV=`< /tmp/fb.xit`
# if [ $EXITV -eq 0 ]...
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2001 06:19 AM
06-14-2001 06:19 AM
Re: fbackup returncode with a pipe
the "tee" in the 1st line, "tee's" only the results of the "echo $? > file". So the result of "tee -ia file" is an emty file.
Do you have any alternatives.
Thanks, Wessel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2001 07:03 AM
06-14-2001 07:03 AM
Re: fbackup returncode with a pipe
Sorry, I lifted some of my code out of context. Try this:
# ( fbackup ... 2>&1 ; echo $? > /tmp/fb.xit ) | tee -ia /tmp/fb.log
# EXITV=`cat /tmp/fb.xit`
# if [ $EXITV -eq 0 ]...
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2001 01:42 AM
06-15-2001 01:42 AM
Re: fbackup returncode with a pipe
Here's some sample perl code that can be used to send output from within a script to multiple file handles:
#!/usr/bin/perl -w
# save the old file handle for STDERR
open(OLDERR, ">&STDERR");
# create some new ones to send output to
# screen and log file
open(OUTFILE, "| tee fbackup.log");
open(STDERR, ">&OUTFILE");
select(OUTFILE);
# send output to tee pipe
$result=system("fbackup ...");
# close output to tee pipe
close(STDERR);
close(OUTFILE);
# send output to STDOUT
select(STDOUT);
# re-attach STDERR
open(STDERR, ">&OLDERR");
if(!$result) {
... your code here ...
}
Hope this works :-)
Vincent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2001 05:46 AM
06-18-2001 05:46 AM
Re: fbackup returncode with a pipe
I found perl in /usr/contrib/bin and I've tried your script and this works. Now I have the same output on screen as wel as in a file. Thanks a lot.
B.t.w. where can I find information / manuals over perl. I don't know anything about perl.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2001 06:09 AM
06-18-2001 06:09 AM
Re: fbackup returncode with a pipe
The No. 1 resource is http://www.cpan.org
AFAIK, the perl version shipped with HP-UX 11.00 is 4.??, which is not as powerful as the more recent versions (5.*). You'll find a depot for a more recent version at http://hpux.tn.tudelft.nl/hppd/hpux/Languages/perl-5.6.1/ .
Regards,
Vincent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2001 06:33 AM
09-06-2001 06:33 AM
Re: fbackup returncode with a pipe
Thanks
Wessel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2001 06:39 AM