9.3.1. Introduction

Packages that include system services should include systemd service units to start or stop those services. See systemd.service(5) for details on the syntax of a service unit file. In the common case that a package includes a single system service, the service unit should have the same name as the package plus the .service extension.

If the package does not include a service unit (if, for example, no one has yet written one), including an init script, as described below, to start the service is encouraged.

Packages including a service unit may optionally include an init script to support other init systems. In this case, the init script should have the same name as the systemd service unit so that systemd will ignore it and use the service unit instead. Packages may also support other init systems by including configuration in the native format of those init systems.

If a service unit is not present, systemd uses dependency information contained within the init scripts and symlinks in /etc/rcn.d to decide which scripts to run and in which order. The sysv-rc runlevel system for sysvinit uses the same symlinks in /etc/rcn.d to decide which scripts to run and in which order at boot time and when the init state (or “runlevel”) is changed. See the README.runlevels file shipped with sysv-rc for implementation details. Other alternatives might exist.

The sections below describe how to write those scripts and configure those symlinks.