UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old October 4th, 2004, 02:10 AM
IcedEarth IcedEarth is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 13 IcedEarth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
tar tar o tar, BEHAVE DAM*** ;)

ok am trying to get an automated tar script going and having trouble getting the directory listing into my tar script. Have three directories that all have to be archived in sequence the first two fit onto a tape but for the third I have to switch tapes. This is where my script is supposed to come in.

ls -lR >dir.txt
grep dir3 dir.txt > dir3.txt

tar -rvfHXI /dev/rmt0 dir.one dir.txt > protocoll

this is the meat and potatoes part of my script. The ifs and whiles all work just here it seems 1st that grep doesnt pull all the files that are under dir3 out. And as everyone knows absolute pathnames are a no no when archiving. Thanks in advance for your help. Oh yeah this is being done under AIX 4.3 (curse curse curse....where is the legacy support?)

Reply With Quote
  #2  
Old October 4th, 2004, 02:34 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,083 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 33 m 4 sec
Reputation Power: 9
so, a little shell

i don't understand why, but if i shound do this:
ls -lR >dir.txt
grep dir3 dir.txt > dir3.txt

i would use:
ls -lR | grep dir3 >dir3.txt
find will make a better job!

----
i also don't know the tar options 'rHXI'
what's 'dir.one' ?

dir.txt is a LIST of files, what do you want: save the LIST or
save the files listed in LIST?

assumed you want save to tape the files listed in LIST:
version 1: (the bad one)

tar cvf /dev/rmt0 `cat dir.txt`
REMEMBER this would not work because of the 'l' in
the 'ls' command above

version 2: (preferred)
tar cvf /dev/rmt0 .

NOTA: tar does not need the '-' sign
the redirect '>protocoll' is useless, then the tar output
is defined by the 'f' opt, in this case '/dev/rmt0'

i don't know if your tar is able to manage multi-volume tapes.
by large files i would use something better like 'ufsdump'

did you still heard about the 'man' command ?

Last edited by guggach : October 4th, 2004 at 02:38 AM. Reason: typo

Reply With Quote
  #3  
Old October 4th, 2004, 03:12 AM
IcedEarth IcedEarth is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 13 IcedEarth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
oops...

apparently I was doing a bit of half asleep googling and the switches X and I are not even supported by this version of AIX.... ... the X was actually supposed to exclude the list in dir.one ( I know unix doesnt need the file endings but its hard to beat outta me also helps keep me straight). And yes you are right guggach I want to save the files in the list, by piping the output to "protocoll" I can also create a log as well as archiving everything that I wanted to. I have gotten that to work on tar commands before. Will try your solution, thnx.

Reply With Quote
  #4  
Old October 4th, 2004, 10:06 AM
andyb1ack andyb1ack is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 60 andyb1ack User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 14 sec
Reputation Power: 4
You're grep isn't working because you're using "ls -lR"

"find" is a much better command, although note that the following will give you different results
Code:
#-- This lists in long format directories but files twice since
#-- it's listing the file and the directory containing the file:
find . -exec ls -l {} \;   

#-- This lists in long format the directories only:
find . -type d -exec ls -ld {} \;

#-- This lists in long format the files only:
find . -type f -exec ls -l {} \;

#-- You could always just do:
find . -ls

Reply With Quote
  #5  
Old October 5th, 2004, 02:04 AM
IcedEarth IcedEarth is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 13 IcedEarth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thx find is a better solution

probably wouldnt have gotten that one on my own. Tried a few things with it before my boss took over our AIX machine so no more scripting today maybe tomorrow. But does anyone know if the results from find can be used well with tar ? It looks good (like I said absolute trees are baaaaad).

Reply With Quote
  #6  
Old October 5th, 2004, 05:44 AM
guggach guggach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Middle Europa
Posts: 1,083 guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level)guggach User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 19 h 33 m 4 sec
Reputation Power: 9
absolute trees are NOT baaaaad
they are very, very baaaaad
and 100% legal

do you like to destroy your system ? try(you need root perms)
cd /; tar cfb - 126k /usr |(cd /tmp; tar xfpv -)
sit down, get a cigar maybe a wisky and watch.....
extremely intructive (keep a cd to rebuild the sys)

btw: ONE char is wrong !!!

you just need 2tons experience to read them back
and it's feasible.....
what do you want, tar a dir (or more) or tar single files ?

Reply With Quote
  #7  
Old October 6th, 2004, 03:14 AM
IcedEarth IcedEarth is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 13 IcedEarth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have three directories I am trying to tar with a script lets call them A B and C and they are so set up that A contains B and C but has several little files that should be archived with B and its structure plus files. That is my first tape. and C is supposed to be my second tape with directory and files. The script I am writing is supposed to ask the user to insert a tape when the A and B have been archived. Problem is with the lists I have been getting I either get the directories or the filenames or I get it so that A, B, and C get archived both times. Havent figured out a way yet to exclude C but inlcude the contents of A plus contents of B with its relative structure.



(I have chainsaw and am looking for vodka drinking trees)

Reply With Quote
  #8  
Old October 8th, 2004, 04:28 AM
IcedEarth IcedEarth is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 13 IcedEarth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
AIX and tar

I have following line in my script

tar -cvhL tarlist /dev/rmt0 <directory> > protocol

reads the list and archives all the data I want onto the tape drive. Problem is my endusers dont like seeing what happens after starting ti I get a message that /dev/rmt0 isnt a viable variable for tar I mean it tars everything ok. anyone have any idea what gives ??

Reply With Quote
  #9  
Old October 8th, 2004, 06:46 AM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 39 m 55 sec
Reputation Power: 184
Quote:
the switches X and I are not even supported by this version of AIX

I am sure they ported GNU tar to AIX too. If you don't have to use the AIX tar for a specific reason, have a look here: http://www.gnu.org/software/tar/

hth,
M.
__________________
--
Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more.

Reply With Quote
  #10  
Old October 18th, 2004, 02:10 AM
IcedEarth IcedEarth is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 13 IcedEarth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
unfortunately I have to use AIX tar. (The customers are too cheap to upgrade their systems from 4.3xxx.) And I gotta program to fit their systems. Got it working now though was actually simpler than I thought. Thanks for the ideas guys.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > tar tar o tar, BEHAVE DAM*** ;)


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway