On 01/16/2012 05:00 PM, Pablo Nehab Hess wrote:
I'm trying to convert Spacewalk's init script to a systemd unit file.

Spacewalk is merely a collection of dependencies; it depends on
{httpd,tomcat6,postgresql}.service and a few others, but there's no
proper daemon or any such thing. The original init script lives at
'/usr/sbin/spacewalk-service' and simply performs 'start' or 'stop' or
'restart'/'reload' for all those dependencies in a specific order.

If the only desirable action was 'start', then a target unit would be just fine.

However, the administrator must be able to at the very least 'stop'
and 'reload'/'restart' it.

The solution I've been using is inserting all but the last dependency
into 'ExecStartPre' and 'ExecStopPost' directives, but does *not* look
correct to me.

Is there any other solution I'm unaware of?

Thanks for any hints.


Given what information you have provided then this should be somewhat in that direction...

[Unit]
Description=Spacewalk

[Service]
Type=oneshot
ExecStart=/usr/sbin/spacewalk-service start
ExecReload=/usr/sbin/spacewalk-service reload
ExecStop=/usr/sbin/spacewalk-service stop
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

I have sometimes used dummy unit with requires as in but that's probably not what you are looking for since you are calling a wrapper script...

[Unit]
Description=foo
Requires=x.service y.service z.service

[Service]
Type=oneshot
ExecStart=/usr/bin/true
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

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

Reply via email to