<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>On Tue, Jan 10, 2023, at 06:47, Markus Rathgeb wrote:<br></div><blockquote type="cite" id="qt" style=""><div dir="ltr"><div><br></div><div><div>How can I declare test2 unit section to ensure it works as expected by me?<br></div></div><div><br></div></div></blockquote><div>There are lots of StackOverflow posts about this... it's not as easy as it seems, so don't feel concerned that your attempt did not work :-)<br></div><div><br></div><div>If you are using a new enough version of systemd, the 'Upholds' and 'PropagatesStopTo' settings for test1, referring to test2, will do what you want. When test1 is running, systemd will ensure that test2 is running as well (and will stop test1 is test2 cannot be started), and if test1 is stopped (for any reason) systemd will stop test2 as well.<br></div><div><br></div><div>test2 will still need Requisite and After settings referring to test1.<br></div></body></html>