Linux – How to create a Cron and cron layout

February 9th, 2011 by admin Leave a reply »

There are several ways you can create a cron on a file.

The first is to edit the file


The second is to type:

 crontab -e

With editing the file /etc/crontab you will have to designate the user that will run the command.

An example would be

*/5 * * * * root  /etc/something/another/run/this 

This would run every 5 minutes. You may also need to tell it what shell to use

*/5 * * * * root  /usr/bin/php /etc/something/another/run/this.php 

This would be a php script.

If you edit cron with just the

crontab -e

command then you do not need to include the user. This is because the cron will run with the user privileges of the user that you where logged in as when you used the command.

*/5 * * * *  /usr/bin/php /etc/something/another/run/this.php 

The basic layout of a Cron command is the following (this is the *’s)

***** commandtorun

When you divide minutes by 5, example */5 * * * * your telling a cron job to run every 5 minutes, divide by 10 = every 10 mins etc…

if you found this helpful feel free to donate to:
ZEC: t1NQp1UuqQbmnXzazbLTSreS2AbaZpRBuTM
LTC: LZyNF1qkBUA7XFz83m5xwzGgmmj1owQn9d

Leave a Reply

You must be logged in to post a comment.