Systemd timer for the first business day of every month

Viewed 803

Just wondering if there is a way to schedule a timer for the first business day of every month? Basically the first day of every month which is not a weekend. I am trying to avoid creating a wrapper script if possible

1 Answers
[Timer]
OnCalendar=Mon..Fri *-*-1..3 00:00:00

This executes the service

  1. only if it is a business day
  2. only the first 3 days of the month

The intersection of these directives leads to the first business day (Monday to Friday) of every month.

Examples:

  • Day 1 is Saturday, day 2 is Sunday, day 3 is Monday. Script runs the 3rd
  • Day 1 is Sunday, day 2 is Monday. Script runs the 2nd
  • Day 1 is Thursday. Script runs the 1st

Source: ArchWiki

Related