Loading...


Related Products


Date Published: February 5, 2025

Cron time string format

Scheduled Jobs in the Acquia Cloud User Interface in each environment of your application use cron to start the job(s) at specific time(s) in UTC.  If you need to set a custom string, it's helpful to have the cron time format. 

The Cron time string format consists of five fields that Cron converts into a time interval. Cron then uses this interval to determine how often to run an associated command on your Drupal site.

For example, a Cron time string of 0 10 15 * * executes a command on the 15th of each month at 10:00 A.M. UTC.

Formatting

The Cron time string is five values separated by spaces, based on the following information:

Character    DescriptorAcceptable values
1Minute0 to 59, or * (no specific value)
2Hour0 to 23, or * for any value. All times UTC.
3Day of the month1 to 31, or * (no specific value)
4Month1 to 12, or * (no specific value)
5Day of the week0 to 7 (0 and 7 both represent Sunday), or * (no specific value)

The Cron time string must contain entries for each character attribute. If you want to set a value using only minutes, you must have asterisk characters for the other four attributes that you're not configuring (hour, day of the month, month, and day of the week).

Note that entering a value for a character attribute configures a task to run at a regular time. If you append a slash ( / ) and an integer to a wildcard in any of the character positions however, you can configure the cron task to run at a regular interval that isn't dependent on a regular time (for example, every X minutes/hours/days).

Examples

Use the following example to create Cron time strings you can use for your site's maintenance needs:

 

Cron time stringDescription
30 * * * *Execute a command at 30 minutes past the hour, every hour.
0 13 * * 1Execute a command at 1:00 p.m. UTC every Monday.
*/5 * * * *Execute a command every five minutes.
0 */2 * * *Execute a command every second hour, on the hour.

If your application needs to perform multiple CRONs it's good practice to alternate the timing the system initializes a specific task. Also, your team should consider the amount of time it takes one cron task to run. By considering these two factors it mitigates a long queue of tasks from forming and negatively affecting the applications performance. 

In the table below it shows an example of several Drush commands staggered to temper the possibility of your application being abnormally inhibited.

Cron time stringType of CRON
*/5 * * * *drush @myenvironment.prod --uri="portal.myenvironment.com" -u 1 -y cron-run
*/7 * * * *drush @myenvironment.prod --uri="portal.myenvironment.com" -u 1 -y cron-run
*/9 * * * *drush @myenvironment.prod --uri="portal.myenvironment.com" -u 1 -y cron-run

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Back to Section navigation