Requires=
no arquivo delayed_job systemd faz o trabalho:
[Unit]
Requires=rails.service
( man systemd.unit
)
Eu criei dois serviços, um para um aplicativo rails e outro para o seu processo delayed_job, eu quero reiniciar o serviço delayed_job toda vez que o serviço rails for reiniciado, posso fazer isso com o systemd?
Você deve considerar o uso de BindsTo
over Requires
, de man systemd.unit
BindsTo=
Configures requirement dependencies, very similar in style to Requires=, however in addition to this behavior, it also
declares that this unit is stopped when any of the units listed suddenly disappears. Units can suddenly, unexpectedly
disappear if a service terminates on its own choice, a device is unplugged or a mount point unmounted without
involvement of systemd.