If youâre running a Fedora CoreOS server, you might want a nightly reboot to keep things fresh or apply updates. CoreOS is minimal and immutable, so weâll use systemd timers instead of cron. Letâs set up a reboot every night at 11 PM.
I use this on homelab appliances. Pair it with Quadlets so services come back without SSH: Pi-hole Quadlet, AdGuard Quadlet, or the full CoreOS + Bitwarden + AdGuard Ignition guide.
Should you even reboot every night?
Good reasons: a predictable reboot after zincati / automatic updates, old hardware that gets flaky after days of uptime, or DNS down for 90 seconds at 23:00 instead of at a random time.
Bad reasons: reboots alone donât make it more secure. Patching does. CoreOS already reboots when Zincati applies an update, depending on your config, so you may only want this timer on machines that rarely update or have automatic reboots disabled.
DNS / DHCP appliances: DNS is down for every client until Podman is back. 03:30 is kinder than 23:00. I use 23:00 below. Change OnCalendar for another time.
Prerequisites
- Fedora CoreOS with sudo (
coreuser). - Correct clock and timezone (
timedatectl). Timers fire in local time unless you use UTC in the calendar spec. - Services that start on boot (Quadlets,
WantedBy=multi-user.target, etc.). - Physical or IPMI/console access the first night, in case the box doesnât come back.
Check the time first:
timedatectldatesystemctl list-timers --all | headIf it says NTP synchronized: no, fix that (sudo timedatectl set-ntp true or whatever your network allows).
Step 1: Create a reboot service
First, create a systemd service in /etc/systemd/system/ to do the reboot. Call it reboot-nightly.service:
sudo nano /etc/systemd/system/reboot-nightly.servicePaste this into the file:
[Unit]Description=Nightly reboot at 11 PM
[Service]Type=oneshotExecStart=/usr/sbin/rebootSave and exit (Ctrl+O, Enter, Ctrl+X in nano). A oneshot service is perfect for a one-and-done action like rebooting.
Why not ExecStart on the timer? Timers activate services. Keeping reboot in its own service lets you test it with systemctl start reboot-nightly.service and add ExecStartPre= later (say, to skip during a backup) without touching the timer. shutdown -r now works as well as /usr/sbin/reboot. Avoid systemctl isolate in a oneshot.
Thereâs no [Install] on the service. We enable the timer.
Step 2: Set up a timer
Now create reboot-nightly.timer in the same directory:
sudo nano /etc/systemd/system/reboot-nightly.timerPaste this:
[Unit]Description=Run nightly reboot at 11 PM
[Timer]OnCalendar=*-*-* 23:00:00Persistent=trueUnit=reboot-nightly.service
[Install]WantedBy=timers.targetSave and exit again. Hereâs whatâs happening:
OnCalendar=*-*-* 23:00:00means âevery day at 11 PMâ (local time).Persistent=truecatches up on a missed reboot if the system was off at 11 PM.- The
Unitline ties this timer to our service.
About Persistent=true: if the box was off at 23:00, it may reboot shortly after it boots. Not great if you power it on at 08:00 for a demo. For a laptop you only sometimes leave on, consider Persistent=false.
Other schedules:
# 03:30 local, every dayOnCalendar=*-*-* 03:30:00
# 23:00 on weekdays onlyOnCalendar=Mon..Fri 23:00:00
# 11 PM UTC regardless of timezoneOnCalendar=*-*-* 23:00:00 UTCSee man systemd.time. Test a calendar string without rebooting:
systemd-analyze calendar '*-*-* 23:00:00'It prints the next run time. If thatâs wrong, your timezone is wrong, not the timer file.
Step 3: Activate the timer
Run these commands:
sudo systemctl daemon-reloadsudo systemctl enable reboot-nightly.timersudo systemctl start reboot-nightly.timerdaemon-reloadrefreshes systemd with our new files.enablekeeps the timer active across reboots.startkicks it off right away (starts the timer, not an immediate reboot).
You shouldnât see errors. enable may print Created symlink ⊠reboot-nightly.timer. If daemon-reload reports a parse error, check the file with systemctl cat reboot-nightly.timer.
To test the reboot without waiting until night (only when youâre ready):
# optional live test â this WILL reboot now# sudo systemctl start reboot-nightly.serviceItâs commented out on purpose. Run it once from the console.
Step 4: Double-check itâs working
Letâs confirm the timer is set:
systemctl list-timerssystemctl status reboot-nightly.timersystemctl list-timers reboot-nightly.timerYouâll see reboot-nightly.timer in the list, with its next run time. If itâs there, youâre golden.
The list-timers columns are NEXT, LEFT, LAST, PASSED, UNIT, ACTIVATES. NEXT should be tonight (or tomorrow if itâs past 23:00). LAST may be - until it first fires.
A few extra tips
- Time zone check: The timer uses local time. Check with
timedatectland change it withsudo timedatectl set-timezone YOUR_TIMEZONE, for examplesudo timedatectl set-timezone America/Denver. - Root access: Youâll need sudo since weâre modifying system files.
- CoreOS quirk: These files live in
/etc, which survives OSTree updates, so you donât recreate them after Zincati. Donât mess with/usr. Itâs read-only by design. - Zincati: if automatic updates also reboot, you can get two reboots in one night. Check
sudo systemctl status zincatiand the FCOS auto-updates docs, and line up the two schedules. - Laptop appliances: for lid-ignore on CoreOS laptops, the beginner CoreOS post has the
HandleLidSwitch=ignoredrop-in. - Disable later:
sudo systemctl disable --now reboot-nightly.timer. You can leave the files orrmthem.
Troubleshooting
Timer never appears
Wrong path (/usr/lib vs /etc), or you forgot daemon-reload. Names must be something.timer and something.service, matching Unit=.
It reboots at the wrong hour
Timezone. Compare timedatectl to your wall clock, and check you didnât add UTC on the calendar line.
It reboots on boot at 8 AM
Thatâs Persistent=true catching up. Set it to false or pick a time the machine is always on.
Quadlet containers do not return after the reboot
Not the timerâs fault. Fix [Install] WantedBy=multi-user.target in the .container file and test sudo reboot during the day. See the Pi-hole Quadlet post.
I want a reboot only if an update is waiting
Thatâs Zincatiâs job. Configure its update strategy instead of scripting around rpm-ostree status.
Wrap-up
And thatâs it! Your Fedora CoreOS server will now reboot every night at 11 PM like clockwork. To change the timing, just adjust the OnCalendar line. Happy automating.
Best regards,
The Linux IT Guy