Cron FTP get and delete
Hey everyone I need a little help here. I want to setup a cron that will do 3 things.
1) It will connect via ftp to a server and download a file called games.log 2) Then delete the source games.log from the ftp site after the download finished. 3) Then run this command line shell php vsp.php -l wet "/public_html/wet/games.log" Can someone please help me out with this? |
Does it have to use FTP?
I ask because FTP is rather difficult to script as there is no way to control it via command line switches, it needs to be controlled interactively as if you were sitting there typing commands into it. In contrast, if you could use some mountable network filesystem (NFS, SSH, etc) then you can mount the remote machine and operate on the files as if they were local. Not to say doing it over FTP isn't possible, it will just be harder. I have certainly never been able to script the functionality I have wanted when using an interactive FTP client, at least. |
You could call the ftp command like:
Call it like ftp user:password@host << EOF get games.log del games.log bye EOF |
Quote:
Code:
ftp -n ftp.server.com << EOF |
Code:
man wget n n n ... I d bet it can download from the ftp Code:
man tail |
Quote:
For example, if we could call an ftp client with commands like: Code:
ftp user:password@host -get games.log |
In man wget, I got this. This may maybe interest you.
Code:
wget -c ftp://sunsite.doc.ic.ac.uk/ls-lR.Z Code:
Specify the username user and password password for both FTP and |
All times are GMT -5. The time now is 01:11 AM. |