Ubuntu core automatic reboot

Hi, I wanted to know how I could set an automatic restart at a certain time of day on ubuntu core 20, on a Raspberry pi.

create a snap that uses the shutdown interface … this interface only allows access to systemd’s reboot call, not to the /sbin/reboot binary … so you need to make a dbus call like:

dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Reboot" boolean:true

from i.e. a shell script you ship as the snaps app …

now you can use a systemd timer to call this app or even set a fixed timer value in your snaps snapcraft.yaml …

2 Likes