Sign inSign up free

719. Replace a Cron Job With a systemd Timer

medium 20 XP ~8 minHands-on lab

The nightly backup of ledgerd runs from cron today. The team is moving it to systemd so it shows up in systemctl list-timers and in the journal. This image is built offline, so systemd isn't running: you only write the unit files.

Task

Create two units in /etc/systemd/system/:

  • ledgerd-backup.service: a one-shot job that runs /usr/local/bin/ledgerd-backup as user ledgerd.
  • ledgerd-backup.timer: starts that service every day at 03:45. If the machine was off at that time, the run happens at the next boot. The timer is installed for timers.target.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Part of Prepare for the LFCS. Next step: Runtime Folders Created at Boot

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.