How to Run a Cron Job Every 80 Days Without Warnings?

0
15
Asked By TechnoWizard42 On

I'm trying to set up a cron job to run every 80 days. On one computer with Ubuntu 22.04, I created it without any issues. However, when I attempted the same setup on another computer running Ubuntu 24.04, I encountered a warning: "Step size 80 higher than possible maximum of 30." Is there a difference between the cron versions on these systems that could be causing this?

6 Answers

Answered By CodingGuru99 On

Instead of trying to set the cron job for every 80 days directly, consider scheduling it to run daily. You can use an if statement inside your script to check if it's been 80 days since the last run. This way, you won't trigger any warnings from cron.

Answered By ScripterX On

What does your cron job expression look like? It could help to see it to diagnose the issue properly.

TechnoWizard42 -

I forgot to include it in my post! Here it is: 45 21 */80 * * certbot certonly --manual --manual-auth-hook /etc/letsencrypt/acme-dns-auth.py --preferred-challenges dns --debug-challenges -d subdomain.domain.com

Answered By UnixBard On

Another option is to use the date command to adjust your settings slightly, setting your target date a few seconds short of the actual date you want to run. Check out 'man date' for details on how that works.

Answered By CronExpert68 On

Just remember that 80 days is equivalent to 115200 minutes. So, you might want to run something like */115200 * * * * in your cron if you want to stick with that long interval. Just keep in mind the limitations mentioned in your warning!

Answered By ShellMaster On

You might want to write a wrapper script that checks the modification time of a file. If it’s been 80 days or more since the last run, execute your desired process and update the file's timestamp. Then just set your cron job to run this wrapper script instead.

Answered By FeedbackKing On

Just so you know, there are different cron versions in Ubuntu 22.04 and 24.04, which is likely why you're seeing that warning. It's essential to be aware of these differences, as they can affect your cron jobs. Have you confirmed that your entry actually works despite the warning?

TechnoWizard42 -

I haven't been able to test it for the full 80 days yet since I just set it up. Waiting to see if it runs as intended without issues is a bit of a challenge!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.