Comments on Modern and practical way to schedule tasks on a Linux machine that is not always on
Parent
Modern and practical way to schedule tasks on a Linux machine that is not always on
What is a modern and practical way to handle scheduling tasks on a Linux desktop?
- Modern means basic features should not rely on obscure or convoluted commands and standards
- Practical means you shouldn't jump through too many hoops to do basic things, it should be usable for 10-100 tasks
- I specify Linux desktop to emphasize that the machine will not be always on, and the approach should still work without that expectation
To be more specific, I want to schedule various things like run a script to check my email, check some sites I follow for updates, check for system updates, do backups. The schedule will usually be a cron-style date time period. When a job run is missed because the computer was not on, I will sometimes want it to be "caught up with" next time it is on, and sometimes to just be ignored, depending on the exact task.
There are some options that I know about, but in my opinion none are ideal. I will post them as separate answers to help add context.
Post
The standard way to schedule tasks in most Linux systems nowadays is to use systemd timers.
This requires writing a systemd timer config file, which has syntax similar to INI. This is summarized in https://wiki.archlinux.org/title/Systemd/Timers and covered in detail in systemd docs.
The timers can be placed in various directories, notably one of these is under ~/.config/systemd/user
which is convenient for versioning it as dotfiles. However, this is very limited, because it does not allow creating subfolder.
The benefit of systemd timers is that they are currently ubiquitous, and systemd has powerful features for keeping track of logs and fine tuning the exact schedule. The drawback is that the timer configs end up being a bit complex, and systemd itself is complex and not that easy to use.
0 comment threads