The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 03:31 PM
Shell Script: want to insert values in database when update script runs ring Shell Programming and Scripting 1 10-25-2007 03:06 AM
here document to automate perl script that call script hogger84 Shell Programming and Scripting 3 10-22-2007 10:15 AM
returning to the parent shell after invoking a script within a script gurukottur Shell Programming and Scripting 5 09-26-2006 07:05 AM
return valuse from child script to parent script borncrazy Shell Programming and Scripting 1 08-20-2004 03:39 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-07-2008
zapper222 zapper222 is offline
Registered User
  
 

Join Date: May 2008
Posts: 12
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
  #2 (permalink)  
Old 05-10-2008
sparcguy sparcguy is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2006
Posts: 315
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 /
  #3 (permalink)  
Old 05-10-2008
zapper222 zapper222 is offline
Registered User
  
 

Join Date: May 2008
Posts: 12
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
  #4 (permalink)  
Old 05-11-2008
frozentin frozentin is offline
Registered User
  
 

Join Date: May 2008
Location: Vienna, VA + Bombay, India
Posts: 109
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).
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0