- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Tar with Shell Scripts
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
09-07-2004 03:07 AM
09-07-2004 03:07 AM
Tar with Shell Scripts
Everything else is working, I know the ignite boot blocks are good, etc, it's just the tar archive read back that is the problem: too verboose. A pain to read at best, and usually gets trunciated by the MS exchange system anyway. Unfortunatly the read-back of the boot block is then lost also.
The vfy cmd used is:
/bin/tar tf /dev/rmt/0m 2>&1 > /dev/null
If I recall correctly from the very distant past, tar does not send the output to standard err under this situation, but how can I trap it? Any suggestions?
Thanks Rt.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2004 03:35 AM
09-07-2004 03:35 AM
Re: Tar with Shell Scripts
To get error messages just PRETEND to restore a BOGUS file:
tar -xvf /dev/rmt/0m crazymanfilename 2>&1 | uuencode errors.txt | mailx -m -s "tar er
rors" youremail@yourdomain.com
You can get errors like:
tar: cannot open nxewtest.tar
or
Tar: error! blocksize changed
or whatever
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2004 03:38 AM
09-07-2004 03:38 AM
Re: Tar with Shell Scripts
tar tf /dev/rmt/0m > testfile.txt
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2004 03:40 AM
09-07-2004 03:40 AM
Re: Tar with Shell Scripts
2 possibilities :
1) after the tar command, verify the return status of the command (under ksh) :
/bin/tar tf /dev/rmt/0m 2>&1 > /dev/null
STATUS=$?
if [ $STATUS -ne 0 ]
then
echo "Problem with tar on `hostname`" |mailx -m -s "pbl with tar" your_name@your_address
fi
tar only retuns 0 if everything is ok ! I test with modifying an tar file and it returns : 3
2) modify your command line to extract any error :
/bin/tar tf /dev/rmt/0m > /dev/null 2> error_tar.txt
if [ -s error_tar.txt ]
then
echo "Problem with tar on `hostname`" |mailx -m -s "pbl with tar" your_name@your_address
fi
With my previous manually modification, error_tar.txt contains :
Tar: tape blocksize error
Hope this helps you !
Olivier.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2004 04:52 AM
09-07-2004 04:52 AM
Re: Tar with Shell Scripts
Try this
/bin/tar tf /dev/rmt/0m >/dev/null 2>&1
This should work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2004 05:07 AM
09-07-2004 05:07 AM
Re: Tar with Shell Scripts
/bin/tar tf /dev/rmt/0m > /dev/null 2>&1
Or maybe even ..../dev/rmt/0mn .... for no-rewind device.
You may also send the output to a file, and send a line count (wc -l) in an email?
And the return code of the tar command too.
JP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2004 06:28 AM
09-07-2004 06:28 AM
Re: Tar with Shell Scripts
In the second case, >/devnull changes stdout, then 2>&1 change stderr to match the current state of stsout, which is /dev/null. Note that there will be no output at all which not what is desired. I would redirect stderr into your email message and let stdout go to your email. That way, you'll get the tar error messages but the table of contents will be sent to /dev/null.
One other note: /bin has been gone for more than a decade. Just like Solaris and other SysV Unices, the v.4 filesystem layout has obsoleted /bin and /lib. They are now /usr/bin and /usr/lib. The reason things seem to work OK is through the use of transition links:
ll -d /bin /lib
lr-xr-xr-t 1 root sys 8 Oct 29 2003 /bin@ -> /usr/bin
lr-xr-xr-t 1 root sys 8 Oct 29 2003 /lib@ -> /usr/lib
These are "transition" links (hint, hint) and may not be installed in future versions of HP-UX.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2004 09:28 AM
09-07-2004 09:28 AM
Re: Tar with Shell Scripts
============================================
With all due respect, I believe Bill intended to say this :-)
============================================
2>&1 >/dev/null says: take whatever stdout (descriptor #1) is and set stderr to the same fd.Then >/dev/null changes stdout to /dev/null but stderr is still going to whatever stdout was in the beginning
============================================
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2004 03:04 PM
09-07-2004 03:04 PM
Re: Tar with Shell Scripts
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2004 03:18 AM
09-29-2004 03:18 AM
Re: Tar with Shell Scripts
Thanks again!
Rt.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2004 03:19 AM
09-29-2004 03:19 AM
Re: Tar with Shell Scripts
Rt.