Cron is not part of Fedora Silverblue (as well as Atomic Host). You can install (overlay) it with rpm-ostree. But it is better to avoid as much as possible to overlay packages in such systems. So, how to take advantage of systemd instead of cron?
Systemd timers
You can use systemd timers to schedule tasks.
Using sudo
Create a .service
and a .timer
file
sudo vi /etc/systemd/system/test.service
sudo vi /etc/systemd/system/test.timer
Then start the timer:
sudo systemctl start test.timer
Let’s see the active timers and their status:
systemctl list-timers
You should see your timer:
To disable a timer:
systemctl stop test.timer
Timers for unprivileged users
With crontab you can create tasks for an individual user. You can do that with systemd as well, without using sudo.
You should create this directory
mkdir -p .config/systemd/user/
And place here the .service
and .timer
files described in the previous paragraph.
Then use the --user
option.
Scheduling syntax
Every 10 minutes (at 0, 10, 20 etc. of each hour):
OnCalendar=*:0/10
Every 2 hours (at 12 am, 2 am, 4 am, etc.):
OnCalendar=0/2:00:00
Every 30 minutes starting from when the timer was enabled:
OnUnitActiveSec=30m
References
Systemd timers man page: https://www.freedesktop.org/software/systemd/man/systemd.timer.html Systemd time and date specification: https://www.freedesktop.org/software/systemd/man/systemd.time.html