Unix/Linux Go Back    


HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

Tarring files to remote server

HP-UX


Reply    
 
Thread Tools Search this Thread Display Modes
    #8  
Old Unix and Linux 03-06-2018   -   Original Discussion by anaigini45
RudiC's Unix or Linux Image
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 23 April 2018, 8:27 AM EDT
Location: Aachen, Germany
Posts: 12,509
Thanks: 401
Thanked 3,878 Times in 3,565 Posts
Quote:
Originally Posted by anaigini45 View Post
. . .
However, the error "tar: cannot open /home/emoaigin/abc.sh" why does it happen?
It's more


Code:
tar: cannot open /home/emoaigin/abc.sh
/home/emoaigin/create.jar
/home/emoaigin/make.gz

because the i variable contains the entire find output including <LF> line terminators. If there are no white space chars in filenames, try to use $i unquoted.

Quote:
And what is this error : "Tar: blocksize = 0; broken pipe?" ?
Might be a consecutive error as the first tar failed and the pipes and thus inputs are empty...
Sponsored Links
    #9  
Old Unix and Linux 03-06-2018   -   Original Discussion by anaigini45
bakunin's Unix or Linux Image
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
 
Join Date: May 2005
Last Activity: 22 April 2018, 4:54 PM EDT
Location: In the leftmost byte of /dev/kmem
Posts: 5,742
Thanks: 112
Thanked 1,667 Times in 1,226 Posts
Quote:
Originally Posted by anaigini45 View Post
The error gzip not found can be resolved by putting the full path to gzip.
However, the error "tar: cannot open /home/emoaigin/abc.sh" why does it happen?
And what is this error : "Tar: blocksize = 0; broken pipe?" ?
First off: i think RudiC is correct in his analysis as to where the errors come from. But the - real - problem is something completely different:

Try to think like an engineer does and solve problems like an engineer would do. You throw 20 commands together and expect them to work flawlessly hand in hand on first try. If that fails you ask us.

How about trying the procedure i showed you with a single file or a single (small) directory? Now you notice you have gzip errors and correct that. Perhaps now it works. Now, on to the next more difficult problem. And so on....

The advantage this has is: whenever in this process an error comes up you understand immediately where it comes from, because the previous version was working. You put together a monstrous kludge of a command and then have no idea how to isolate the myriad of (maybe, maybe not) interdependent error conditions, some of which may (or maybe not?) corrected.

Instead of writing "the gzip error could be corrected" - why don't you just do it, run again and post what happens then?? In case all the other stuff would have worked the missing gzip would still have caused the rest of the pipeline to fail and you would still get the same tar-error because this is how tar reacts to empty input. But why do we have to take interactions between different unrelated errors into account when you cannot be bothered to do anything on yourself to isolate the persistent errors?

A child would say "toilet isn't working" - and call for adult help. Adults would observe that the water system works in this part of the house, but not in that part. So they would analyse the pipe system and find out that somewhere between here and there must be a problem. They might then proceed to correcting that problem.

I hope this helps.

bakunin
The Following User Says Thank You to bakunin For This Useful Post:
RudiC (03-06-2018)
Sponsored Links
    #10  
Old Unix and Linux 2 Days Ago   -   Original Discussion by anaigini45
MadeInGermany's Unix or Linux Image
MadeInGermany MadeInGermany is offline Forum Staff  
Moderator
 
Join Date: May 2012
Last Activity: 23 April 2018, 9:35 AM EDT
Location: Simplicity
Posts: 4,037
Thanks: 346
Thanked 1,358 Times in 1,224 Posts
Quote:
Originally Posted by anaigini45 View Post
@Bakunin, I tried the method you suggested, and this was the error :



Code:
# i=`find /home/emoaigin \( -name '*.sh' -o -name '*.jar' -o -name '*.gz' \)`
# tar -cvf - "$i" | gzip | ssh emoaigin@10.61.1.58 "cd /home/emoaigin ; cat - | gzip -cd | tar xf - "
sh: gzip:  not found.
tar: cannot open /home/emoaigin/abc.sh
/home/emoaigin/create.jar
/home/emoaigin/make.gz
Password:
sh: gzip:  not found.
Tar: blocksize = 0; broken pipe?
#

The error gzip not found can be resolved by putting the full path to gzip.
However, the error "tar: cannot open /home/emoaigin/abc.sh" why does it happen?
And what is this error : "Tar: blocksize = 0; broken pipe?" ?
One of the few occasions you should not quote a variable in command arguments. To avoid unwanted expansions set -f (noglob) and set IFS to only a newline.


Code:
# PATH=/bin:/usr/bin:/path/to/gzip
# i=`find /home/emoaigin \( -name '*.sh' -o -name '*.jar' -o -name '*.gz' \)`
# (set -f; IFS="
"; tar cf - $i) | gzip -c | ssh -x emoaigin@10.61.1.58 "cd /home/emoaigin && gunzip -c | tar xvf - "

Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script connect to remote server, not find files and exit only from remote server, but not from scrip digioleg54 Shell Programming and Scripting 3 04-18-2017 12:31 PM
Tarring files up to four days old MIA651 UNIX for Dummies Questions & Answers 1 03-07-2013 02:22 PM
Bash Tarring not un Tarring correctly satnamx Shell Programming and Scripting 5 07-20-2009 04:16 AM
tarring large no. of files marwan UNIX for Dummies Questions & Answers 4 08-19-2007 03:45 PM
backup : files being modified while tarring jamesbond UNIX for Dummies Questions & Answers 5 10-15-2001 08:58 AM



All times are GMT -4. The time now is 11:33 AM.