im trying to set up a cronjob to run a PHP file. i just want to know if i am doing it right or not.
lets say the php is located at http://mysite.com/myscript/cronjob.php, and i want it to run every 3 hours.
i am very new to cronjobs so i apologise if it seems like i have no clue what i am doing.
Minute Hour Day Month Weekday Command
* */3 * * * http://mysite.com/myscript/cronjob.php
i want this to run that PHP script every 3 hours. will this work or do i have to use a different command?
No, this won’t work. A URL is not an executable, it is simply a URL.
You could put
wget http://mysite.com/myscript/cronjob.phpfor your command, but is that really what you want?The best way (if the script is on the local server) is to call PHP directly:
php /var/www/myscript/cronjob.php