Wise Web Hosting

An Australian Based
Web Hosting Business

Portal Home > Knowledgebase > Getting Started > Running cron Jobs using wget


Running cron Jobs using wget




In some instances you may wish to run a cron job by calling a URL directly. This may be the case when it is not necessary to have the script in a secure location as anyone can run the script if it can be executed via a call to a url.

When using wget to execute a script in the command would look something like this:

wget http://www.yourdomain.com/cron/sendemailbatch > /dev/null 2>&1

To elaborate a little,

wget http://www.yourdomain.com/cron/sendemailbatch

Executes the script located at http://www.yourdomain.com/cron/sendemailbatch

By adding > /dev/null 2>&1 to the end your are basically putting output from the command into a black hole making the script run quietly.

To set this up in cPanel, first log into your cPanel then select the "Cron Jobs" tab

Under the section labelled "add new cron job" select a common setting for the frequency of the cron job or create your own using the options in the select option drop downs.

After the frequency of the cron job is set you need to enter the command that will be executed, using the example able this would be:
wget http://www.yourdomain.com/cron/sendemailbatch > /dev/null 2>&1

Then click on the "Add New Cron Job" button and your done.

See the below screen shot for an example of how a cron job is set up in cPanel.

Add a new cron job cPanel



Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read

Powered by WHMCompleteSolution

Language: