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?
You can use systemd timers to schedule tasks.
.service and a
sudo vi /etc/systemd/system/test.service
[Unit] Description=Print date and test string into /tmp/test [Service] Type=oneshot ExecStart=/usr/bin/sh -c '(/usr/bin/date; /usr/bin/echo test) >> /tmp/test'
sudo vi /etc/systemd/system/test.timer
[Unit] Description=Run test.service every day at midnight [Timer] OnCalendar=Mon..Sun *-*-* 00:00:00
Then start the timer:
sudo systemctl start test.timer
Let’s see the active timers and their status:
You should see your timer:
... Fri 2019-02-15 00:00:00 CET 23h left n/a n/a test.timer test.service ...
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
.timer files described in the previous paragraph.
Then use the
systemctl --user start test.timer systemctl --user list-timers
Every 10 minutes (at 0, 10, 20 etc. of each hour):
Every 2 hours (at 12 am, 2 am, 4 am, etc.):
Every 30 minutes starting from when the timer was enabled:
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