Pixelated a phpBB Template by SkaidonDesigns
Cheapest Web Software Support Area Forum Index www.cheapestwebsoftware.com
Play with the Best, be the Best!
Blogs Organizer
Log in to check your private messages
Log in

The Mightiest Webmaster Solutions Ever
Blogs Automater
Blogs Automater
Rocket Pinger
Rocket Pinger
Cheapest Web Software
Cheapest Web Software
Links Organizer
Links Organizer

Haven't registered yet? Do it here now!
Adding Cronjobs Manually Tutorial!

Post new topic   Reply to topic    Cheapest Web Software Support Area Forum Index -> F.A.Q
View previous topic :: View next topic  
Author Message

Joined: 22 May 2004
Posts: 4284
Location: The Net

PostPosted: Fri Jun 22, 2007 10:31 pm    Post subject: Adding Cronjobs Manually Tutorial! Reply with quote
This is a tutorial which we hope will give a light on the serious confusion most people have when it comes time to Setup Cronjobs Manually!

The tutorial explains the exact way to add your cronjobs in Cpanel hosting admin, but it is the same for every other hosting control panel and server setup.


A regular cronjob of our scripts looks like:
* * * * * /usr/bin/php /path/to/yourscripts/script.php >> /dev/null

The first part * * * * * is the time settings of the cronjob listed in order: minutes, hours, days, months, wekdays.
So in our example with all stars, translated to english means every minute, so the cronjob will run each minute.
If you for example change it to 0 * * * * that means every zero minute, or more easily understand as every hour. If you for example chage it to 0 0 * * * thats means every zero minute on every zero hour, or more easily said every day at midnight. So knowing these, you can change any of these to what numbers you need.

The second part of the cronjob - /usr/bin/php /path/to/yourscripts/script.php >> /dev/null is the COMMAND that the cronjob will execute each time it runs.


There are multiple ways to execute a php script from a cronjob. Just you need to know what program from your server you can use.
Our example in the above cronjob uses /usr/bin/php as the program that will execute the script. But if thats not correct path or it is not available at all on your server, you can use any other program thats available. Here's some samples with their variations:

/usr/bin/php /path/to/yourscript/script.php >> /dev/null

/usr/bin/local/php /path/to/yourscript/script.php >> /dev/null

lynx -dump http://www.yourdomain.com/yourscript/script.php >> /dev/null

curl http://www.yourdomain.com/yourscript/script.php >> /dev/null

GET http://www.yourdomain.com/yourscript/script.php >> /dev/null

POST http://www.yourdomain.com/yourscript/script.php >> /dev/null

wget --spider http://www.yourdomain.com/yourscript/script.php >> /dev/null

Try to always use PHP (/usr/bin/php or /usr/local/bin/php)! Unless it is said you should use something else from the script documentation. PHP is the most reliable and fast way to execute a php script from a cronjob!

The ">> /dev/null" added at the end is to make sure nothing will be output from the cronjob, because on certain server setups that might interrupt the script execution.


Go to your CPanel administration screen of your hosting account and from the icons available there locate the one saying Cronjobs and click on it.

A new screen will appear and on it click on Advanced (Unix Style)

A new screen appears:

Here just do the following:

- Enter the times for the cron job in the Minute , Hour , Day , Month , or Weekday fields. You can look for those directly from the cronjob syntax example provided from our script itself.

- Enter the cronjob command in the "Command" field. You look for it directly from the cronjob syntax example provided from our script itself.

- Click on "Commit Changes" button.

As we said this is direct example with CPanel hosting control panel, but it applies and to any kind of other hosting control panels. Just located the Cronjobs section and proceede like here..

Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger ICQ Number

Display posts from previous:   
Post new topic   Reply to topic    Cheapest Web Software Support Area Forum Index -> F.A.Q All times are GMT + 2 Hours
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2002 phpBB Group