Hmmm consider writing a little program to insert in the pipe that filters 
all output until it gets a marker.

ssh root@martel 'echo "MARKER"; tar cvf - /home/mikel/testing' | filter.pl 
| dd >/dev/rmt0


filter.pl goes something like this..
#!/usr/bin/perl
$mark=0;
while(<STDIN>) # read a line from STDIN
{
        if($mark==1) # if we've already found the marker
        {
                print $_; # output the line to STDOUT
        }
        elsif(/MARKER/) # if line matches marker
        {
                $mark=1;
        }
        # else don't do anything (ie eat the line)
}
# the end
Naturally you could do this in the language of your preference.


On Sun, 21 Oct 2001, Mike Lake wrote:

> Hi guys,
> 
> Persuant to a suggestion that I should not be trying to backup machines
> using tar over NFS as it can lead to probs (such as root on the remote
> machine not being able to read the machine to backup) I have been trying
> to get tar over ssh going.
> 
> This was the problem I had.....
> Date: Sun, 7 Oct 2001 09:29:00 +1000
> \begin{Mike Lake}
> > I am having a problem getting tar to backup one machine (martel) which 
> > has it's home directories NFS exported to the machine with the tape
> > drive on it (tazieff). The prob is basically that root cannot read
> > some
> > files as it seems the uid/gid numbers don't match between the
> > machines.
> 
> Angus wrote....
> > tar has support for reading over rsh (or ssh).
> > since NFS authentication is IP-based, rsh should be no less secure. ssh
> > would obviously be the best alternative.
> > it'll be much nicer on the network, avoid permission issues, etc if you
> > use that method instead of NFS.
> 
> so I am now using ssh. I did a search on google and it suggested a few
> ways. Most were just ssh'ing an already created tar file across to the
> backup machine. What I want is a stream of data from the machine to
> backup to the machine with the tape drive on it. That way I won't run out
> of diskspace sometime.
> 
> I have authorized keys on both machines so root can login using ssh with
> no passwd and I have changed the /etc/ssh/sshd_config file to allow root
> logins via "PermitRootLogin yes" (slug archives helped there !)
> 
> This is the script that runs:
> -----------------------
> root:# cat test
> #!/bin/bash
> 
> # This is what will run when it all works :-)
> #ssh root@martel 'tar cvf - /home' | dd > /dev/rmt0
> 
> # This is here for testing, testing dir contains a few files
> ssh root@martel 'tar cvf - /home/mikel/testing' 
> -----------------------
> 
> The problem is that when ssh logs into root .bashrc & .profile gets run
> and there is some output from the login shell. This is prepended to the
> tar file so its not a tar file anymore. I can see the lines of the login
> if I run "/test | more". 
> 
> This is what I want to do: Backup all home directories on the Alpha
> by streaming the contents via ssh or scp to the backup machine with 
> the tape drive. The script would be started FROM the backup machine with
> the tape drive on it.
> 
> Question: 
> How do I stop the login stuff from prepending to the tape.?
> Is there a better way to pipe tar through ssh or use scp? so
> that it streams from the Alpha to the tape machine.
> 
> Mike
> 

-- 
---<GRiP>--- 
Web: www.arcadia.au.com/gripz 
Phone/fax: 02 4950 1194   
Mobile: 0408 686 201


-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to