dh_installsystemd - Linux
Overview
dh_installsystemd
is a helper script for Debian packages, that automatically creates a systemd service for the package. It is part of the debhelper package.
Syntax
dh_installsystemd [-C|--copyright] [-h|--help] [-v|--version] [-i|--local|--local-INI] [-m|--man]
[-W|--update-initramfs|--install-update-initramfs|--initramfs-install-update]
[-s|--systemd-script|--script=PATH] [-c|--config|--conf=FILE]
[-u|--unit] [-U|--no-unit] [-X|--no-symlink] [-Y|--no-depend] [-r|--reload] [-a|--action]
[--mangle=PACKAGE] [--regex=REGEX] [--] [SERVICE...]
Options/Flags
-i
,--local
|--local-INI
: Use the INI format file.-m
,--man
: Generate man pages using man2html.-W
,--update-initramfs
|--install-update-initramfs
|--initramfs-install-update
: Update the initramfs when the package is updated.-s
,--systemd-script
|--script=PATH
: Use the specified systemd script.-c
,--config
|--conf=FILE
: Use the specified configuration file. Defaults todebian/SYSTEMD.conf
if it exists, or/usr/share/systemd/debian/default.conf
.-u
,--unit
: Install a systemd unit for the service.-U
,--no-unit
: Do not install a systemd unit for the service.-X
,--no-symlink
: Do not create a symlink to the service file.-Y
,--no-depend
: Do not create a dependency on the service.-r
,--reload
: Reload the systemd manager.-a
,--action
: Do not invoke systemd.
Examples
To create a systemd service for the foo
package:
dh_installsystemd foo
To create a systemd service and use a custom script:
dh_installsystemd -s /path/to/my_systemd_script.conf foo
Common Issues
- If the systemd service fails to start, check the journalctl logs for errors.
- If the systemd service is not recognized, make sure the package is installed and the service is enabled.
- If the
dh_installsystemd
script exits with an error, check the output for more information.
Integration
dh_installsystemd
can be used with other debhelper scripts to create more complex packages. For example, it can be used with dh_systemd_enable
to automatically enable the service at boot time.
Related Commands
make-systemd-unit-files
systemd
debhelper