How to setup cron job in cPanel to execute a URL

Many times we have been asked how to use the command line script ‘wget’ to run programs via http links. (Most commonly used by Sendroid Ultimate)

This method works just like typing the URL on your web browser. The great thing about wget command is that unline the other methods, this options allows you to use all HTTP request features such as $_SERVER variable within your script, even when it is being called by cron tab. 

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-Omeans 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 :

  • 5 Uživatelům pomohlo
Byla tato odpověď nápomocná?

Related Articles

How To Change cPanel Default Time Zone

The .htaccess file is a hidden text file within your hosting account that can be very powerful....

How To Restore a Home Directory Backup in cPanel

In this article I'm going to show you how to restore a partial home directory backup in cPanel....

How to Create a MySQL Database in cPanel

When you create a database, many users are unaware that there are several other items that you...

Install SSL certificates with cPanel SSL/TLS Manager

Enable SSL/TLS Manager in WHM for cPanel users Before using the SSL/TLS Manager as a cPanel...

5 Important Things to Consider When Choosing a Domain for Your Business or Website

When first setting up any website, one of the hardest — but most important — things to decide is...