Hacker News new | ask | show | jobs
by gumby 2560 days ago
Isn’t that what cron is for?
3 comments

Systemd has a cron system too.

I’m just guessing, but it might be easier to programmatically install a systemd cron job (and making sure it runs) than doing so for the old/conventional crond?

Just using cron is back compatible
Things you get with systemd that you don't get with cron unless you implement them in the script.

* Not running if the network is down.

* Not running if the download path isn't available.

* Running if the machine was off during the scheduled time.

* Monitoring and retry logic.

* Logging to syslog.

* Resource constraints.

* Random wait.

It ends up being a lot of code factored out of the actual application.

so instead of code in one place you have it in 2?
I don’t understand this logic. Can you explain why having code in more than one place is a bad thing?
For a simple script that does one thing, it's overkill.
He probably wants to learn more about systemd and needs/wants a project to do it.

Yes, obviously cron would work. If systemd can do what this dev needs, what's the harm?

You're right, but I like the extensibilty of Systemd. Things like running every week or whenever the next start is. Or only if the network is online.