[systemd-devel] Restarting service does not work
Cecil Westerhof
cldwesterhof at gmail.com
Sun Dec 21 06:14:27 PST 2014
2014-12-21 14:52 GMT+01:00 Andrei Borzenkov <arvidjaar at gmail.com>:
>
> В Sun, 21 Dec 2014 13:24:16 +0100
> Cecil Westerhof <cldwesterhof at gmail.com> пишет:
>
> > 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20141221/9ed1a3f6/attachment.html>
More information about the systemd-devel
mailing list