How to setup cron job in cPanel to execute a URL

Use the command line script ‘wget’ to run programs via http links.

Here is an example of the wget script in action:

wget -q -O /dev/null "http://mysite.com/cronjob.php" > /dev/null 2>&1

Using -O means that the output of the web request will be sent to STDOUT (standard output).

>/dev/null 2>&1  will instruct standard output to be redirect to a black hole. So no message from the executing program are returned to the screen.

Below is a screenshot of using wget for a cron job in cPanel :

 

 

 

 

 

 

 

 

 

 

 

Was this article helpful?

Related Articles