The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
help me in sending parameters from sqlplus script to unix shell script Hara Shell Programming and Scripting 2 01-29-2008 12:31 PM
Shell Script: want to insert values in database when update script runs ring Shell Programming and Scripting 1 10-25-2007 12:06 AM
here document to automate perl script that call script hogger84 Shell Programming and Scripting 3 10-22-2007 07:15 AM
returning to the parent shell after invoking a script within a script gurukottur Shell Programming and Scripting 5 09-26-2006 04:05 AM
return valuse from child script to parent script borncrazy Shell Programming and Scripting 1 08-20-2004 12:39 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-07-2008
Registered User
 

Join Date: May 2008
Posts: 11
tar in a script

I am trying to write a simple script where I tar a few files and send them to tape

The code looks like this:

tar -cvf archive/tam/*20080507* archive/sam/*20080507* source/delta/*20080507*

This runs fine from the command line but when i try to run this in a script I get an end of tape error.

Anyone know whats wrong ???

Thanks
Zapper
Reply With Quote
Forum Sponsor
  #2  
Old 05-09-2008
Registered User
 

Join Date: Nov 2006
Posts: 260
the syntax: is tar -cvf <destination like tape drive or tar file> <files to backup>

example: tar -cvf /dev/rmt/0 /etc /var # will backup /etc and /var to tape drive /dev/rmt/0

tar -cvf /tmp/ball.tar /etc /var # will backup /etc and /var to a file called /tmp/ball.tar

what you are doing tar -cvf archive/tam/*20080507* archive/sam/*20080507* source/delta/*20080507*

is being interpreted as trying to backup archive/sam/*20080507* & source/delta/*20080507* to a file called *20080507* inside archive/tam/

And maybe the error that's coming is not tape as it's not show you specified a tape device. Probably the error is trying to tell you that it's out of space. do a df -k and check the folder where "archive" located, I think it may be 100% full.

the clean way to tar a few files from different location.

example if I wanted to backup all the files under archive
cd /archive

ls -1 * > /tmp/xxx

tar -cvf /dev/rmt/0 `cat /tmp/xxx`

cd /
Reply With Quote
  #3  
Old 05-10-2008
Registered User
 

Join Date: May 2008
Posts: 11
Ok thanks
So I am wondering why this works from the command line
From what you are saying, I have to specify the tape drive if I am doing this from a script but from the command line it interprets the tape drive on its own somehow ??

Zapper
Reply With Quote
  #4  
Old 05-10-2008
Registered User
 

Join Date: May 2008
Posts: 33
zapper222:

Could it be that you didn't specify "f" on the CLI? If so, then tar sends its o/p to the first tape drive by default.

tar's behavior could be different on your platform, but this holds true for Solaris (/dev/rmt/0).
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:09 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0