What is a drop-in file? What is a drop-in directory? How to edit systemd service
Jan 21
I want to change how a custom systemd service works.
systemctl edit serviceName
This edits /etc/systemd/system/serviceName.d/override.conf file. Override.conf is called a drop-in file and serviceName.d/ is a drop-in directory. I want to put a drop-in file definition and drop-in folder definition on the internet.
1 answer
Accepted answer · original discussion
Jan 21
I would define: drop-in file - a file, which is contained in a drop-in directory and the contents of which are concatenated to the (service) unit file with the same name as the drop-in directory. E.g. for /etc/systemd/system/service-name.d/override.conf - override.conf is called a drop-in file and service-name.d/ is a drop-in directory.
Writing into override.conf for example ExecStart=/usr/bin/example-service will concatenate this to the list of elements in the ExecStart command in the unit file. If we want to override the ExecStart command, then we need to first reset the command with ExecStart= and then add our commands.
override.conf should be eg:
[UNIT]
ExecStart=
ExecStart=/usr/bin/example-service
1 question comment
Use comments to ask for clarification. Post a solution as an answer.
Jan 28