Creating new systemd services
This example shows how to create a unit file for a custom service. Custom unit files are located in `/etc/systemd/system/` and have a `.service` extension. For example, a custom `foo` service uses `/etc/systemd/system/foo.service` unit file.
You are logged in as a user with administrator-level permissions.
This procedure creates a basic configuration file to control the `foo` service.
Create and edit the new configuration file:
# nano /etc/systemd/system/foo.service
The next few steps describe each section its parameters to add to the file:
The `[Unit]` section provides basic information about the service. The `foo` service uses the following parameters:
A string describing the unit. _Systemd_ displays this description next to the unit name in the user interface.
Defines unit to use as a dependency for the service. If you activate the unit, _systemd_ activates the units listed in `Requires` as well. For example, the `foo` service might require network connectivity, which means the `foo` services requires `network.target` as a dependency.
The resulting `[Unit]` section looks like this:
Description=My custom service
The `[Service]` section provides instructions on how to control the service. The `foo` service uses the following parameters:
Defines the type of _systemd_ service. In this example, the `foo` service is a `simple` service, which starts the service without any special consideration.