Tarring files to remote server


 
Thread Tools Search this Thread
Operating Systems HP-UX Tarring files to remote server
# 8  
Old 03-06-2018
Quote:
Originally Posted by anaigini45
. . .
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...
# 9  
Old 03-06-2018
Quote:
Originally Posted by anaigini45
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
This User Gave Thanks to bakunin For This Post:
# 10  
Old 04-21-2018
Quote:
Originally Posted by anaigini45
@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 - "

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script connect to remote server, not find files and exit only from remote server, but not from scrip

I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)
Discussion started by: digioleg54
3 Replies

2. Shell Programming and Scripting

Do I require remote login access to a windows server to transfer files from a UNIX server

Hi All I need to transfer a file from a UNIX server to a windows server. I saw that it is possible to do this using scp command by looking at the forum listed below: ... (2 Replies)
Discussion started by: vx04
2 Replies

3. Solaris

Script to get files from remote server to local server through sftp without prompting for password

Hi, I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script. Can anyone help me in automating the script such that it... (3 Replies)
Discussion started by: ssk250
3 Replies

4. UNIX for Dummies Questions & Answers

Tarring files up to four days old

Hi I need help in tarring files up to four days old. I have been doing this: find . -mtime -4|xargs tar -cvf mar4.tar However, it seems like it's tarring everything but leaving those that are 4 days old and newer (which I want tarred and everything else not) ---------- Post updated at... (1 Reply)
Discussion started by: MIA651
1 Replies

5. Shell Programming and Scripting

Bash Tarring not un Tarring correctly

HI All, Im encountering behaviour that is not correct for my requirements when I untar a file. Im using the below command to tar up files from various folders to the ARCHIVE folder as below... tar -cvf "$ARCHIVE_PATH"/"$dte_tar_filename" "$LOG_PATH" "$PROCESSED_PATH2" "$ERROR_PATH" ... (5 Replies)
Discussion started by: satnamx
5 Replies

6. Shell Programming and Scripting

tarring/compressing files in Unix directory

hi guys, i'm totally new with Unix sripting and no idea how to do the scripting at all. My problem is that my boss asked me to do this: 1.) create a script that will tar or gzip the files in particular directory eg: i'm on my home directory and I need to tar/gzip the file in.. assuming... (1 Reply)
Discussion started by: montski
1 Replies

7. UNIX for Dummies Questions & Answers

tarring large no. of files

dears, I have a folder containing huge no. of files, some of them are created on AUG 16, AUG 17 and AUG 18, for example. All I want to do is tarring all the files created on a certain date, say AUG 18, in one tar file, only in one command line. So, how to feed all the files created on a certain... (4 Replies)
Discussion started by: marwan
4 Replies

8. Shell Programming and Scripting

FTP multiple files from remote server to local server

Hi, I am facing a weired problem in my FTP script. I want to transfer multiple files from remote server to local server everyday, using mget * in my script. I also, want to send an email for successful or failed FTP. My script works for file transfer, but it don't send any mail. There is... (2 Replies)
Discussion started by: berlin_germany
2 Replies

9. UNIX for Dummies Questions & Answers

tarring and gzipping dump files

Say I want to transfer several dump files from a Solaris machine onto a Win2k machine for storage. It was suggested that I tar and gzip the dump files before doing so. Is it completely necessary to use both of these utilities, or is it sufficient to compress multiple dump files into one gzip... (4 Replies)
Discussion started by: PSC
4 Replies

10. UNIX for Dummies Questions & Answers

backup : files being modified while tarring

I would like to back up several directories weekly using a cronjob. I'm not experienced in UNIX, but I would start like this: tar -cvf backup.tar dir1 dir2 dir3 Now if a file is being modified in the process it will result in an error. How can I prevent this from happening and how can I... (5 Replies)
Discussion started by: jamesbond
5 Replies
Login or Register to Ask a Question