Write and Enable a systemd Service

medium 20 XP ~7 minHands-on lab Pro

/opt/relay/bin/relay is a daemon that has been started by hand. This server image is built offline, so systemd is not running yet. Prepare the service the way it will run in production.

Task

Create the unit /etc/systemd/system/relay.service so that:

  • it runs /opt/relay/bin/relay --config /etc/relay.conf
  • it runs as user relay and group relay
  • it starts only after the network is online (network-online.target), and wants that target
  • it restarts on failure, waiting 5 seconds between attempts
  • it has a Description mentioning relay

Then enable it for the normal multi-user boot, exactly as systemctl enable would.

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.

TerminalNot started

Your machine is ready to start

Create a free account to open a machine and get graded.