<START SCRIPT>
#!/bin/sh
# ----------------------------------------
# FTP script
#
# This is where you specify the settings for the ftp
# Changes will be: host,user & password
# ----------------------------------------
host=nnn.nnn.nnn.nnn
user=USER
password=PASSWORD
destination=/path/to/somewhere
errorlog=/path/to/ftperror.txt
#------------------------------------
echo "-----------------------------" >> $errorlog
echo `date` >> $errorlog
echo "-----------------------------" >> $errorlog
ftp -v -n $host << EOF >> $errorlog
user $user $password
prompt
ascii
cd $destination
lcd /path/to/local/directory
mput *
quit
EOF
print "Proces complete"
<END SCRIPT>
If you want a more secure method use scp (secure copy) with public/private keys this way you encrypt your data while it is transferred.
As for the cron to run a script, cron is usually to run a process/script at a given time/date for nTimes, now you may need to produce a more detailed script if the cron is to run on a regular basis and not overwrite files on the reciveing end server.
You could also take a look at wget (as this has options that check if local file is newer than remote) that way you save bandwidth and prevent overwrites.
Feroz....is correct...I would also add that you might want to transfer your files in binary. Instead of ascii to do this simply put "bi" where ascii is in his outline.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.