Sending tar output to a remote host


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Sending tar output to a remote host
# 1  
Old 03-08-2006
Sending tar output to a remote host

Our group has recently inherited 15 servers that have not been maintained for over a year.
My first action is to backup the units however there is not enough disk space on most of them to run tar. My supervisor said to look at piping the tar output to another machine, however I have been unable to get this to work.
I tried the command below
tar -cv test.tar acc/ - | ssh user@sport:/home/user/temp/
but I get the error message Pseudo-terminal will not be allocated because stdin is not a terminal.

I could use some help getting started on this since I dont know where to go from here.
Links to appropriate reading would also be greatly appreciated.
Thanks
# 2  
Old 03-08-2006
You've almost got the command. You have forgotten to use tar on the other side of the ssh and the tar on the local server has some problems as well. Here you go:
Code:
tar -cf - acc/ | ssh user@sport (cd /home/user/temp; tar -xf - )

You can stick a 'v' in the tar command if you want verbose output.
# 3  
Old 03-08-2006
Quote:
Originally Posted by blowtorch
You've almost got the command. You have forgotten to use tar on the other side of the ssh and the tar on the local server has some problems as well. Here you go:
Code:
tar -cf - acc/ | ssh user@sport (cd /home/user/temp; tar -xf - )

You can stick a 'v' in the tar command if you want verbose output.
Thanks Blowtorch. I've got a question on the command you show. Why is the tar -xf - needed? Since I dont want to untar the file on the server as it is going to be written to a tape should the command be
tar -cf - acc/ | ssh user@sport (cd /home/user/temp )

Also, I've also come across the netcat command and it looks like it might work equally well. Is there any advantage to using either netcat or ssh?

Thanks for the help.
# 4  
Old 03-08-2006
Oh, OK. My mistake. I thought this was a simple transfer of files thing. Can you try this command instead?

Code:
tar -cf - *|ssh -l remote_user remote_host cd /some/tmp/dir\; tar -xf -\;tar -cf /path/to/tape \*

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check/get the exit status of a remote command executed on remote host through script

Geeks, Could you please help me out in my script and identify the missing piece. I need to check/get the exit status of a remote command executed on remote host through script and send out an email when process/processes is/are not running on any/all server(s). Here's the complete... (5 Replies)
Discussion started by: lovesaikrishna
5 Replies

2. UNIX for Dummies Questions & Answers

Remote FTP Backup -Tar archive+ encrypt+ split to a remote ftp

I have a huge directoy(200+ gb) for backup. I want upload the tar file(split files) simultaneous to a remote ftp. (pipeline, stdout, stdin etc.) I don't want write a data to local hdd. I have a ssd hdd. thanks. this code doesn't work.( yes i know the problem is split command!) tar cvzf -... (8 Replies)
Discussion started by: tara123
8 Replies

3. Shell Programming and Scripting

Pause processes in remote host and resume execution in another remote host

Hi, Given addresses of 2 remote machines, using a shell script is it possible to get the state of running processes in "src" stop all the processes in "src" exit out of "src" ssh into "dest" resume the state of executing processes captured in step 1 in "dest" Assumption: "src" is... (3 Replies)
Discussion started by: Saeya Darsan
3 Replies

4. UNIX for Advanced & Expert Users

Help! How to find the local host after few ssh hops to remote host???

I do a ssh to remote host(A1) from local host(L1). I then ssh to another remote(A2) from A1. When I do a who -m from A2, I see the "connected from" as "A1". => who -m userid pts/2 2010-03-27 08:47 (A1) I want to identify who is the local host who initiated the connection to... (3 Replies)
Discussion started by: gomes1333
3 Replies

5. Shell Programming and Scripting

running commands to remote host from centralized host

Gurus/Experts We have a centralized UNIX/Solaris server from where we can actually ssh to all other UNIX/Solaris servers...I need to write a script that reside on this centerlized server and do FileSystem monitoring (basically run df -h or -k) of other remote servers and then send an email to me... (6 Replies)
Discussion started by: anjum.suri
6 Replies

6. Shell Programming and Scripting

Run a shell script from one host which connext to remote host and run the commands

I want to write a script which would run from one host say A and connect to other remote host B and then run rest of commands in that host. I tried connecting from A host to B with SSH but after connecting to host B it just getting me inside Host B command prompt. Rest of the script is not running... (6 Replies)
Discussion started by: SN2009
6 Replies

7. UNIX for Dummies Questions & Answers

Sending Commands to a Remote Host

I am trying to write a script that logs into an SMTP server and authenticates as a user or verifies that a user exists. I can do all this from the command line but I don't know how to write a script to do this for me, I login and then the script stops, I'm sure this is some basic principle. ... (3 Replies)
Discussion started by: safetytrick
3 Replies

8. Solaris

How to delete the files from local host to remote host

Hi all, i am copying .gz files from production server to development server using "scp" command.my requirement is after copying .gz files i want to delete old .gz files(two days back) in development server from production server. like this way i need to delelte .log ,.z and .dmp files... (3 Replies)
Discussion started by: krishna176
3 Replies

9. Solaris

Tar files, transfer to remote host and delelte source

Hi, I´m having a problem here. I have a directory that holds many subdirs and files (by many I mean MANY thousands). What I want to do is make blocks of these files and transfer them block by block to a remote host; but once a given file is already placed in the remote host, the script must... (0 Replies)
Discussion started by: Dago
0 Replies

10. UNIX for Dummies Questions & Answers

How to specify the remote host?

Hi, I want to compare 2 set of dierectories, one is current host, other in remote, I am tring like this: diff $HOSTTOBACKUPH:$SOURCEHR $DR_BACKUP_DIR_H/hourly.0 I am getting fowlling error> diff: ctlrws123:/home/arbuser/temp2/mscdr/sor_d: No such file or directory how to specify the... (2 Replies)
Discussion started by: redlotus72
2 Replies
Login or Register to Ask a Question