0
votes

I have a script called urlretrieve.php that I have placed on my web server. Lets say the web address is www.example.com/urlretrieve.php and when you visit this website, a file from an ftp site is downloaded called download.zip and placed into the same folder as urlretrieve.php on the web server. I need this website to be visited (executed) once a week so that the ftp file downloads once a week. My question is, what should my cron job command be? At the moment I am using

0 14 * * 3 wget http://www.example.com/urlretrieve.php

and it isn't working. I have tested many others, but no luck.

I am using CPANEL.

Edit: This is the urlretrieve.php script

<?php 
$url = "ftp://alt.ncsbe.gov/data/ncvhis1.zip";
$fh = fopen(basename($url), "wb");
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fh);
curl_exec($ch);
curl_close($ch);
?>
1
Consider just using the command php /your/path/to/urlretrieve.php instead, and better still, move it to a non-web accessible location. - halfer
Doesn't work HOW? Did you bother looking at the wget docs to see how to tell it where to write the output file? As-is, it's going to be downloading that file into the home directory of whatever account this job is running under. - Marc B
If it is just a script somewhere, you can use web based cron services such as setcronjob.com - Jonathan Kuhn
The behaviour of the script it depends on the script itself you can post it. There's a particular reason for the script to be accessible directly in your web root? - TooShyToAsk
I have tried this command "php /home/user/public_html/path/to/file/downloads/urlretrieve.php" and nothing happens - user3529701

1 Answers

0
votes

For this task you SHOULD use php CLI every friday at 8:10

10 8 * * 5 php /path/to/your/script.php