[Drupal] How to configure cron jobs for drupal site on an Amazon AWS (bitnami stack)?

| | 2 min read

Drupal depends on a cron system to execute period tasks in Drupal. This cron system in turn expects a call to the cron.php file from a client either as a Drupal shell request or as an http request to the Drupal site. The following outlines how to set up a cron job in an Amazon AWS server set up using the bitnami stack.

Before going into how to set up cron you can see the different cron commands given below:

  1. Create a new crontab file or edit your existing crontab file.
    crontab -e
  2. For listing all the cronjobs that you have set so far.
    crontab -l
  3. For removing all existing cronjobs that you have set so far.
    crontab -r
  4. You can have cron email the output of the cron job by setting the following in your crontab.
    [email protected]

The following are the steps for setting up a cron job in your AWS server

  1. Edit your cron job file as.
    crontab -e
  2. Add the following command with the first part replaced by the specific numbers or * for matching each of the integers in the range
    minute(0 - 59) hour(0 - 23) day(1 - 31) month(1 - 12) weekday(0 - 7) (Sunday=0 or 7) wget -O - -q -t 1 http://example.com/cron.php?cron_key=YOUR-KEY

    If you want your cron to run every hour this could be set up as

    0 * * * * wget -O - -q -t 1 http://example.com/cron.php?cron_key=YOUR-KEY

    In drupal sites the cron_key is available in the status report page at Administration » Reports » Status report.

  3. You can check your cron tasks with following command.
    crontab -l