Systemd unit file implementation questions (ypbind)

Michal Hlavinka mhlavink at redhat.com
Thu Apr 14 09:14:14 UTC 2011


Hi,

I have similar question (sorry for stealing this thread). I have package 
that has 3 services (they somehow depend on each other). Based on 
configuration in /etc/sysconfig/.. file it starts 2 or 3 services. This is
handled by init script, but I don't know how to do it in systemd service
file.
AFAIK:
a)
EnvironmentFile=...
ExecStart=[ -n "$DRIVER" ] && /start/driver/...
ExecStart=[ -n "$BACKEND" ] && /start/backend/...
ExecStart=[ -n "$MONITOR" ] && /start/monitor/...

won't work, because ExecStart must be path, not shell command

b)
ExecStart=/usr/libexec/%{name}/startifset "$DRIVER" /start/driver
ExecStart=/usr/libexec/%{name}/startifset "$BACKEND" /start/backend
ExecStart=/usr/libexec/%{name}/startifset "$MONITOR" /start/monitor

won't work, because there ExecStart can't be used more than once, 
except with type=oneshot, which does not work here

c)
ExecStart=/usr/libexec/nut/startthemall

this is only workable solution I know (for now), but I don't know if it's the best one

d) split it to more service files and make dependency there

this would be incompatible change in configuration and hard to do, because 
dependency can change with configuration


Is there a good solution for this?

Michal





More information about the devel mailing list