Setting up a systemd Service under Ubuntu

Posted on Sat 11 November 2017 in Sysadmin

Starting with 15.04, Ubuntu uses systemd instead of Upstart as the default system and service manager. This page offers a good comparison between the two systems.

If you want to add a new systemd service (e.g. for running a Java application everytime your machine boots), create the following file under /etc/systemd/system/myservice.service:

Description=My Service Description

ExecStart=/bin/bash -c "java -jar /path/to/jar/MyService.jar"
# see


After creating or modifying a unit file, you should reload the systemd process itself to pick up your changes:

sudo systemctl daemon-reload

To enable a service to start automatically at boot, type:

sudo systemctl enable unsereernte.service

You can start the service by typing:

sudo systemctl start unsereernte.service

Aside from start, you can stop, restart, or reload the service.

A systemd component called journald collects and manages journal entries from all parts of the system. This is basically log information from applications and the kernel.

To see all log entries, starting at the oldest entry, type:


A good tutorial on systemd services can be found here.