Using Cron

=Using Cron=

For more information, give this site a shot.

Using cron is very easy, and there are a thousand tutorials in google that help. But here is a summary,

You can edit the crontab with crontab -e. Please remember that each user has his own crontab. Certain crontabs use the Nano editor if you configured it, and that's easy to use. But if it's using VI, then

To Edit, go to the line, press 'A' to enter the edit mode, then edit.

To Delete, go to wherever you are, make sure you're not in the edit mode (press , then press the 'D' button to delete)

To exit and save, press , then :wq

To exit without saving, press , then :q!

Crons:


 * To execute something once a day, every day, at midnight, use

0 0 * * * /bin/sh /path/to/script

the first 0 is the hour, the second is the minutes.. so you can change the time to whatever you want.


 * To execute something every 5 minutes, use

* */5 * * * /bin/sh /path/to/script

This is useful for executing the cron.php for Drupal's CMS, or any other scripts such as backup or archiving scripts for your host or project.. If you want it as 30 minutes, replace the /5 with /30. Etc...