need help with a cron job
Posted: Sat Jul 15, 2006 9:05 pm
I would like to set up a cron (that part I can do), to grab a file from my web server on a weekly basis using ftp.
the ftp part I can do *I think* (see below) also, it's just figuring out how I can grab a file with a dynmically created name:
ex:
that file gets created two days before I will run this cron so I need a way to grab the file with the name of two days prior.
I currently have this set up and working using php to generate a file called script.ftp that looks something like this:
I call that file with a windows batch file that looks like this:
all works great. but since I want to move this job over to my new ubuntu box, I figured I should come up with a better way to do it.
I'm pretty sure that I should be able to do all of this on one cron (without having to create all of these extra files), but the syntax for figuring out two days ago eludes me (actually the syntax for writing a date eludes me but I didn't want to tell you that).
can anyone please shed some light on this for me?
thx,
Burr
the ftp part I can do *I think* (see below) also, it's just figuring out how I can grab a file with a dynmically created name:
ex:
Code: Select all
data-07-12-2006.tar.gzthat file gets created two days before I will run this cron so I need a way to grab the file with the name of two days prior.
I currently have this set up and working using php to generate a file called script.ftp that looks something like this:
Code: Select all
open 88.88.88.88
user administrator
somepassword
lcd c:\mylocalfolder\
get data-07-12-2006.tar.gz
quitCode: Select all
ftp -n -s:script.ftpI'm pretty sure that I should be able to do all of this on one cron (without having to create all of these extra files), but the syntax for figuring out two days ago eludes me (actually the syntax for writing a date eludes me but I didn't want to tell you that).
can anyone please shed some light on this for me?
thx,
Burr