Create cronjob alternative on Ubuntu Core

Featured image

The task

I need to run a shell script every hour.


  • Ubuntu Core as a read-only filesystem, only user home folder is writable.

The basic concepts

Cronjobs can’t be used on a read-only fs. Only snap packages can be installed on Ubuntu core. It is possible to make a snap for this. It is possible to create a systemd user timer.

The solution

I choose the more agnostic and simple way: systemd user timer!

First we need to create systemd user folder

$ mkdir -p ~/.config/systemd/user/

Systemd user timers only run if the user is logged in, to avoid this we need to enable lingering session with:

$ sudo loginctl enable-linger <username>

Now create servicetimer unit file (update-ddns.service)

Description="A script to update DDNS record value"



And timer unit file (update-ddns.timer)

Description="Update DDNS record value"



And scp them to ~/.config/systemd/user folder.

And then finish systemd setup:

$ systemctl --user daemon-reload

and then you can enable the timer with

$ systemctl --user enable update-ddns.timer --now

and view the result with

$ systemctl --user list-timers
$ systemctl --user status update-ddns

Don’t forget the /<username>/ script!


Relax and grab a coffee…

Photo credit: Danilo Paissan on