SPUG: Quoting Question

Bill Campbell bill at celestial.com
Mon Oct 16 17:17:54 PDT 2006

On Mon, Oct 16, 2006, Asa Martin wrote:
>   Hi everyone,
>   Long-time lurker, infrequent poster, but I have this really annoying
>   quoting question. I'm writing a remote SSH script (but not using
>   Net::SSH so any solution can't utilize any special Net::SSH stuff). I
>   log into a remote system using ssh, read a file from the remote system
>   into memory, parse through it line by line, and on certain lines make
>   substitutions. Then I need to write the new file to the system. I am
>   trying to send the changed stuff to the new file using the echo
>   command, but it's not working very well.

I generally use rsync for this type of thing because (a) one can
easily restrict access to specific directories controlling access
by IP address, and (b) it doesn't require potentially dangerous
security issues when allowing passwordless unattended operations.

rsync remotesystem::remote_module/filename /tmp/filename
process filename
rsync /tmp/filename remotesystem::remote_module/filename

There are a variety of options to rsync that can be used to
insure safe copies (it generally creates a new file, renaming it
when done so that programs using it won't see a partial file).

INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Software, LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

``The fact is that the Constitution was intended to protect us from
the government, and we cannot expect the government to enforce it
willingly'' -- Dave E. Hoffmann, Reason Magazine March 2002

More information about the spug-list mailing list