Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create an FTP script and put it in cron?

Status
Not open for further replies.

antzzz

Programmer
Mar 9, 2001
85
AE
Hi! I need to connect to an FTP server from SCO Unix at 1:30 am everyday to get some files. I want to run a cron job to do this to relieve operators of doing it manually just to retrieve the files. How do you code a proper FTP script and how do you include it in cron properly (ie I want errors to be logged to an error log file, for example, if FTP fails or if the file doesn't exist). Thanks for any help or code given!
 
Here is a simple ftp script I use on a SCO box

#ftp script
#
ftp -inv <<!
open 192.168.10.1
user username password
bin
put filename
quit

I execute this script from another script that gets executed by cron. That script is listed below

date > /var/adm/ftpout

./dataftp >> /var/adm/ftpout 2>&1
pid2=$!

echo `$pid2` >> /var/adm/ftpout

exit 0

Its basic, but it gets the job done.


-Danny






 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top