2014-12-21 14:52 GMT+01:00 Andrei Borzenkov <[email protected]>:
>
> В Sun, 21 Dec 2014 13:24:16 +0100
> Cecil Westerhof <[email protected]> пишет:
>
> > I have a service in which I log vmstat info in a H2 database. Of-course
> > this is only useful when H2 is actually running. So I have the following
> > service file:
> >
> >     [Unit]
> >     Description=Logging vmstat to H2 Database
> >     Requires=h2.service
> >     After=h2.service
> >
> >     [Service]
> >     Type=simple
> >     ExecStart=/home/cecil/bin/vmstatLog.sh
> >     Restart=always
> >     User=cecil
> >
> >     [Install]
> >     WantedBy=multi-user.target
> >
> > ​It works insofar that when h2 stops, vmstatLog also stops. But when h2
> is
> > started again, vmstatLog does not start and needs to be started manually.
> > What am I doing wrong?​
> >
>
> Nothing; this is expected behavior. Dependency in systemd is
> unidirectional; you may want to change [Install] section to
>
> WantedBy=h2.service
>
> so that starting h2.service will also start your service.
>

​Works likes a charm. Thanks.​


​The name is a bit of a misnomer (vmstatLog is not wanted by h2) but I can
live with that.​

-- 
Cecil Westerhof
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to