:::: MENU ::::

Execute cron on a specific day of the month (e.g. second monday)

  • Feb 12 / 2018
  • 0
Linux

Execute cron on a specific day of the month (e.g. second monday)

How to execute a cron on a specific day of the week once in the month?

This could look simple as we could think that this line in cron would do the trick:

But this would not work as the ‘2’ for checking the Tuesday will come as a OR condition, and the command would be executed from day 8 to day 14 and on every Tuesday of the month.

As a workaround for that, you can use that command:

Here is the explanation of this cron line:

Doing this check will allow to verify first that we are on the second tuesday before to execute the command. Don’t forget to add a backslash before the ‘%’ character to escape it.

Share...Share on Google+Tweet about this on TwitterShare on RedditShare on LinkedInShare on FacebookEmail this to someone

Comments are closed.

Question ? Contact