I want to know whether there is any easier way to run a job every 20 days. In cron job, if you specify the day parameter as */20
, it'll run only on 20th day of each month, IE basically becomes once every month.
The trick from CronJob every 25 minutes work for minutes but cannot apply to day I'm afraid, unless I'm running the cron job every day to check.
That'll be my last resort, but I'm wondering if there is any better/clever way to do it.
More info
This is for renewing purpose, thus can be done sooner than 20 days. But I'm doing it from my laptop, which would be put into sleep most of the time. Thus guarantee execution is a must (which I read that cron is lack of).
date
check once a day is hardly a reason to exclude the simplest and clearest solution. At least it is testable on a scale of days, whereas a complex solution may have edge cases that occur once a year. And no solution is going to run on a hibernating system. You might checkman anacron
. – Paul_Pedant Apr 26 '23 at 20:48OnCalendar=
(to set the first occurrence) andOnUnitActiveSec=20d
perhaps – steeldriver Apr 26 '23 at 21:12Persistent=
boolean but I don't have enough experience to whether it would work the way you want – steeldriver Apr 26 '23 at 21:32