Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

How to schedule cronjob for every 45 days?

How to execute a shell script via a cronjob every 45 days?
by

1 Answer

Bharatgxwzm
If you don't need exactly 45 days, but "one and a half months" will do, then a straightforward method would be to run at the beginning of the month every three months, and at the middle of the next month after each of those:

0 12  1 1,4,7,10   /path/to/script
0 12 16 2,5,8,11
/path/to/script

For general arbitrary intervals, the other answers are obviously better, but 45 days sounds like it's based on the length of a month anyway. Human users might also be more used to something happening in the beginning or the middle of a month, instead of seeing the exact date drift a day or two each time.

Login / Signup to Answer the Question.