Notes
Saved for later

Installing your systemd service





This is a summary of how to write your own systemd service file.

Write the unit file

A Unit file has the file suffix .service

Create your .service file anywhere you like

Let’s call it demo.service

[Unit]
Description=Your own description of the service

[Service]
WorkingDirectory=/path/to/startup/directory
ExecStart=/path/to/executable/binary
Restart=always
User=username
Group=groupname

[Install]
WantedBy=multi-user.target

Install your service

systemctl enable /full/path/to/your/demo.service

If you get an error message like

Failed to execute operation: No such file or directory

You might have missed to enter the full path to your demo.service. You can’t use relative paths.

Creative Commons License