Search Our Database
Cron Job Example
If you have a script that needs to be executed on a scheduled basis, a cron job can be set up to execute your script using the following methods:
Executing the script using PHP from Crontab
The following script executes the PHP script every 10 minutes.
*/10 * * * * /usr/local/bin/php -q /home/username/domains/domain.com/public_html/pathtoscript/script.php > /dev/null 2>&1
Executing the script using wget
The script below calls the URL of the script using wget every 5 minutes.
*/5 * * * * /home/username/wget --output-document=/dev/null http://domain.com/pathtoscript/script.php > /dev/null 2>&1
Running the script using cURL
The following script executes the PHP script by calling the URL using CURL every 5 minutes.
*/5 * * * * /home/username/curl --output-document=/dev/null http://domain.com/pathtoscript/script.php > /dev/null 2>&1
For more information regarding cron job timings, crontab.guru is an excellent resource for checking cron schedule expressions.