<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2014-12-21 14:52 GMT+01:00 Andrei Borzenkov <span dir="ltr"><<a href="mailto:arvidjaar@gmail.com" target="_blank">arvidjaar@gmail.com</a>></span>:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">В Sun, 21 Dec 2014 13:24:16 +0100<br>
Cecil Westerhof <<a href="mailto:cldwesterhof@gmail.com">cldwesterhof@gmail.com</a>> пишет:<br>
<div><div class="h5"><br>
> I have a service in which I log vmstat info in a H2 database. Of-course<br>
> this is only useful when H2 is actually running. So I have the following<br>
> service file:<br>
><br>
>     [Unit]<br>
>     Description=Logging vmstat to H2 Database<br>
>     Requires=h2.service<br>
>     After=h2.service<br>
><br>
>     [Service]<br>
>     Type=simple<br>
>     ExecStart=/home/cecil/bin/vmstatLog.sh<br>
>     Restart=always<br>
>     User=cecil<br>
><br>
>     [Install]<br>
>     WantedBy=multi-user.target<br>
><br>
> ​It works insofar that when h2 stops, vmstatLog also stops. But when h2 is<br>
> started again, vmstatLog does not start and needs to be started manually.<br>
> What am I doing wrong?​<br>
><br>
<br>
</div></div>Nothing; this is expected behavior. Dependency in systemd is<br>
unidirectional; you may want to change [Install] section to<br>
<br>
WantedBy=h2.service<br>
<br>
so that starting h2.service will also start your service.<br></blockquote><div><br><div class="gmail_default" style="font-family:courier new,monospace;display:inline">​Works likes a charm. Thanks.​</div> </div><br><div class="gmail_default" style="font-family:courier new,monospace">​The name is a bit of a misnomer (vmstatLog is not wanted by h2) but I can live with that.​</div><br></div>-- <br><div class="gmail_signature">Cecil Westerhof</div>
</div></div>