Create a systemd service configuration

August 8, 2018
Linux Systemd

Systemd is a system and service manager for Linux. It can run tasks in parallel (unlike SysVinit) which helps reducing boot time with tasks executed simultaneously. These tasks are called units and their configs are stored in files in the format unit_name.type_extension in the /etc/systemd/system location.

The type_extention identifies the unit type, which may be a service, a mount, etc.

A unit service has a further type definition that configures the unit startup functionality. The “types” are listed as follows:

In the above example, I defined the type as forking, therefore the program will run detached from the main execution process.

The After directive indicates that syslog and network services should have been started prior to starting “My Program 123”.

More information about systemd configuration can be found in the RHEL 7 System Administrator’s Guide.