how to run cron job every 3 months?

Solution 1:

The following will run script on the 1st of Jan, Apr, Jul and Oct at 03:30

30 03 01 Jan,Apr,Jul,Oct * /path/to/script

Alternatively, but less obvious

30 03 01 */3 * /path/to/script

Will run every three months at 03:30 on the 1st of Jan,Apr,Jul and Oct.

Solution 2:

Wikipedia has a nice explanation about how to configure Cron.

For your specific case you could run a Cron Expression to run every 3 months- obviously change the months to suit your schedule.

0 0 1 JAN,APR,JUL,OCT  * /path/to/script.bash

Solution 3:

The accepted answer is good, thou I'd use an alternative with simpler numbers and easier to read: https://crontab.guru

0 0 1 */3 *

Read like this: “At 00:00 on day-of-month 1 in every 3rd month.”

Tags:

Linux

Unix

Cron