How to run a cron job every 3 days

Created on December 9, 2022 at 9:05 am

Crontab is a program used to schedule tasks to run automatically on a computer. It is commonly used to automate system maintenance or administration. With crontab, you can run a command or script at a specific time, day, week, or month. For example, you could use crontab to automatically run a backup script every night at midnight, or to send yourself an email reminder every Monday morning. To use crontab, you must have access to a Unix-like operating system, such as Linux or macOS.

To run a cron job every 3 days, you would use the following syntax in your crontab file:

0 0 */3 * * command_to_run

This cron job would run every day at midnight, and the */3 part of the syntax specifies that the job should run every 3 days.

Here’s a brief explanation of the other parts of the syntax:

  • The first two numbers (0 and 0 in this case) specify the hour and minute when the job should run. In this case, the job will run at midnight (hour 0 and minute 0).
  • The next two numbers (* and *) specify the day of the month and the month when the job should run. The * means that the job should run every day of the month and every month.
  • The last number (*) specifies the day of the week when the job should run. The * means that the job should run every day of the week.

If you need more help with cron syntax or setting up cron jobs, you can type man crontab into a terminal to read the crontab man page. This will provide detailed information about the crontab file format and the options you can use in your cron jobs.

Connecting to lzomedia.com... Connected... Page load complete