DSL Tips and Tricks :: Automating ftp



I just discovered a much faster way of doing routines like updating web  pages, etc., using automated scripts.  First, setup .netrc with user name, password:

example:
01 machine mysite.net login xxxxx password xxxxxxx

Now write your routine to a  file. Common commands include cd, send, get, bye:

example, ftp_script:

cd /mypath/file
get file
bye

To run, type" ftp mysite.net < ftp_script" and the task is performed within seconds.  The script can be run within a larger script, for example, that opens amaya.uci to the file you just ftp'd over.  Very fast!!!

example:

  #!/bin/bash
    ftp mysite.net < get_index
    [ -d  /opt/amaya ] || mydsl-load /mnt/hda3/Downloads/amaya.uci
 
     /opt/amaya/wx/bin/amaya index.htm &

The use of .netrc has been a part of DSL's webdata program to store and retrieve files on an ftp server automatically.
Quote (roberts @ Nov. 18 2007,17:00)
The use of .netrc has been a part of DSL's webdata program to store and retrieve files on an ftp server automatically.

..great feature!

BTW, not sure how to get /apps/net/ftp  working.  It takes me to an ftp> window, but doesn't connect if I type in an address.
EDIT: just figured it out......(need 'open' command)


original here.