You can't.  But you can use ssh directly.  Same authentication to remote host, 
as well as same config setup.   For simplicity, put options in config file, 
either user's ~/.ssh/config or global ssh_config file if many users using this 
script/connection.  Maybe call it tapeserver2tape and redefine Host to just 
tapeserver in that machine stanza, e.g. 

Host  tapeserver2tape
    Hostname    tapeserver
    User        operator
    Compression yes
    ..  
    [ other ssh options you want, Protocol, etc. ]
   
Then run command as:

    cat compress_scpdb_jr.sh | ssh tapeserver2tape 'dd of=/dev/nrmt0h'
    
Better still is to use tar instead of cat, so tape is in std format for later
viewing.

    tar compress_scpdb_jr.sh | ssh tapeserver2tape 'dd of=/dev/nrmt0h'

You could also put a small script in the programs path called scp2tape with the 
following:

---------

#!/bin/sh

# scp2tape - Grab host and tape, then use tar on other opts to remote dd via
# ssh...  NOTE: it only expects a list of files and as last arg remote host and
# remote tape drive.  Any -opts will fail, use config file or add code to case.

rem_host=
rem_tape=
files=
# Loop args getting files and remote host and tape
for i in "$*"
do
     case "$i" in 
                # rem_host will be user@host if sent that way.  ssh understands 
                # this as well.
         *:*)   rem_host=`echo $i | cut -d: -f1`
                rem_tape=`echo $i | cut -d: -f2`
                ;;
         *)     files="$files $i"
                ;;
     esac
done
tar -cf - $files | ssh $rem_host "dd of=$rem_tape"

--------

You can then have the scripts run:

     scp2tape compress_scpdb_jr.sh operator@tapeserver-tape:/dev/nrmt0h
     
You can modify and add command line options you want to catch to the case above. 
I did it this way to keep it simple (just thrown together), relying on the 
config file and the special machine name for options processing.

Hope this helps.

        --Dave
        



    
>From: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>cc: [EMAIL PROTECTED]
>Subject: using scp to copy to remote tape?
>Mime-Version: 1.0
>Date: Fri, 12 Jan 2001 09:56:52 -0500
>
>Our Oracle DBAs have a script that will allow them to use scp
>to copy a database to a remote host. They'd like to convert it
>to copy to tape on a remote host (on our site), and then ship 
>the tapes (rather than try to scp across the WAN). Straight scp
>complains that I am not writing to a directory when I try it:
>
>scp -vC compress_scpdb_jr.sh operator@tapeserver:/dev/nrmt0h/
>
>Sending file modes: C0755 31391 compress_scpdb_jr.sh
>scp: /dev/nrmt0h/: Not a directory
>
>and I can find nothing in the FAQ indicating that this will work.
>Can anyone suggest any good alternatives that will still use scp,
>around which the script is built, to write to tape somehow?
>
>Regards,
>
>-- 
>Judith Reed
>[EMAIL PROTECTED]
>
>

--
David Knight French                           
Black Mountain Computer Consulting
Voice: (858)279-4862
Email: [EMAIL PROTECTED]

Reply via email to