How to set cron job on unix

29 Jun

Are you looking for how to set cron job on Unix? Then you are at the right blog.

Go to command prompt and type command below.

#crontab -e

This will open one file for you.

Write following line in it

* * * * * /usr/bin/wget -q http://your-drupal-site.com/cron.php

(Above cron will run every minute.)

If you are using vi editor press escape :wq and return key to save your cron.

You can check your cron jobs using following command

#crontab -l

This will list your all existing cron jobs.

Important
When using SSL then you need to add one more parameter while calling wget to run cron job successfully.

Cron job when using SSL

* * * * * /usr/bin/wget -q –no-check-certificate https://your-drupal-site.com/cron.php

note there is one more parameter added in above syntax that is –no-check-certificate

Kindly leave your comments for any queries or suggestions.

Thank you.

3 Responses to “How to set cron job on unix”

  1. Fernando Khumlo June 29, 2011 at 11:28 am #

    As we do have the URL and well Drupal do provide a proper user interface to execute cron job. What is the difference between running cron from command prompt and from browser?

  2. Admin June 29, 2011 at 5:29 pm #

    Yes Fernando, Drupal has provided interface to execute cron job manually. But your admin user will need to go and run cron manually every time. Instead you can set cron job and system will run it self.

  3. Zakir Khan June 29, 2011 at 7:47 pm #

    Simple but a very useful article.

    cheers !!!!

Leave a Reply

*