I'd like to know if there's a way with Systemd
to restart A.service
(After
) when B.service
get started or reloaded (reload config only), if possible without editing B.service
which is installed and upgraded by the system.
A.service
should start even if B.service
is not installed, disabled or stopped.
A.service
:
[Unit]
After = B.service network-online.target
Wants = B.service
[Service]
Type=oneshot
ExecStart = /script.sh start
ExecStop = /script.sh stop
RemainAfterExit=yes
[Install]
WantedBy = network-online.target
B.service
:
[Unit]
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/cmd start
ExecStop=/cmd stop
ExecReload=/cmd reload
PIDFile=/var/run/cmd.pid
[Install]
WantedBy=multi-user.target