问题原文
原帖链接 · vane · CC BY-SA 3.0
I have a unit file and I want to modify some of the properties. I've been able to extend all the properties using the /etc/systemd/system/unitname.service.d/ directory but cannot get the WantedBy property to be extended.
Original Unit File (deluged.service)
[Unit]
Description=Deluge Bittorrent Client Daemon
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=media
Group=media
ExecStart=/usr/local/bin/deluged -d -u 0.0.0.0
[Install]
WantedBy=multi-user.target
/etc/systemd/system/deluged.service.d/override.conf
[Unit]
BindTo=sys-subsystem-net-devices-tun0.device
After=sys-subsystem-net-devices-tun0.device
[Service]
ExecStart=
ExecStart=/usr/local/bin/deluged -d -i 10.10.10.1 -u 0.0.0.0
[Install]
WantedBy=
WantedBy=sys-subsystem-net-devices-tun0.device
Everything appears to work correctly except for WantedBy when I run systemctl enable deluged it still created the symlink in multi-user and no link is created in the new location.
I've searched for documentation on extending/overriding and I haven't seen anything talking about WantedBy so I have no idea if it's even possible to extend it. Am I doing something wrong or is it just not possible?
已采纳解答
原帖链接 · maxschlepzig · CC BY-SA 4.0
Older systemd releases don't support overriding the [Install] section with drop-in files. With those you need to create a replacement file for this service, instead.
Similarly, the Conflicts= key in the [Unit] section can't be overridden in a drop-in file, either.
Systemd removed that limitation in the end of 2017, thus, versions released after that aren't affected.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
