Create a systemd daemon
03 Feb 2018Like it or hate it, you’ll find systemd on any modern linux system these days. This management subsystem is the newer replacement for the older init scripts-based systems.
In today’s article, I’m going to show you how to create a daemon that will sit under the management of systemd.
.service
file
A service file instructs systemd how to interact with the deployed application. It’s referred to as the service unit configuration. The following is an example:
Installation
This file, once you’ve created it gets deployed to systemd with a cp
. You also need to notify systemd.
Interacting with the service
Once the service is in place, you can start to interact with the daemon using systemctl
.
You can also get a hold of any log pushed out to the standard system file descriptors:
Removal
Once you no longer need your service, you can remove it simply my rm
‘ing the .service
file. Of course, you’ll need to disable your service first.
That’s it for creating a systemd service.