[systemd-devel] Service with alternative configuration

Lennart Poettering lennart at poettering.net
Mon Mar 11 15:18:03 UTC 2019


On Do, 07.03.19 14:03, Marv Lelgemann (144dbspl at gmail.com) wrote:

> I have a systemd service unit of type "dbus". I would like to have the
> option to restart (or stop and start) the service with additional command
> line arguments in "ExecStart".

Do something like this:

    mkdir -p /etc/systemd/system/foo.service.d/
    cat > /etc/systemd/system/foo.service.d/override.conf <<EOF
    [Service]
    ExecStart=
    ExecStart=/path/to/my/command --with=a --new-commandline
    EOF
    systemctl daemon-reload
    systemctl restart foo.service

i.e. add a drop-in that first resets ExecStart= to the empty list, and
the writes the new cmdline to use into it.

Lennart

--
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list