Every day I need to upload automatically about 100 images with a total size of 4MB.
I've used ncfttput and FTP via command line, but sometimes the upload of one image gets stuck with a Connecting to port message, and so it stops the FTP-upload of the others.
I'm currently using this script:
#!/bin/bash
cd /home/giacomo/WRF/DOMAINS/puglia/postprd
ftp -i -n -v <<EOF
open "server"
user "username" "password"
binary
cd /www.example.org/wrf
mput 2mTemp*.gif
quit
EOF
sleep 10
ftp -i -n -v <<EOF
open "server"
user "username" "password"
binary
cd /www.example.org/wrf
mput 850mbRH*.gif
quit
EOF
etc...
How could I set a timeout with a consequential retry? Or is there a non-command line method to manage all of this automatically (sync my local folder with my remote folder and take care of any errors)?
rsync
and/orssh
access? If not, you can use thetimeout(1)
command to limit the runtime of any givenftp
attempt. Is there any reason you are reconnecting for each image? Is it because the connection may hang on any given image?ls
after themput
and compare the remote listing with a local one, and repeat theftp
if there are differences.ftp
transfers: it is very reliable, and retries when necessary, but it's not suitable for automation. I make regular small automated transfers with the standard Ubuntu and Windows command-lineftp
: my number and size of files are much smaller than yours, and I have had few problems (I use passive mode).