[systemd-devel] start service only on specific exit status of some prog
Lennart Poettering
lennart at poettering.net
Wed Aug 24 07:01:01 PDT 2011
On Tue, 02.08.11 17:06, Marius Tolzmann (tolzmann at molgen.mpg.de) wrote:
>
> hi..
>
> since conditions specifying wheter a service should start are
> somehow limited to the existence of some files/directories/etc. i
> was searching for something more complex to handle conditional
> service starts.
>
> is there a way to execute a program and take its exit status to
> evaluate the condition? like ConditionExec or whatever.
>
> currently we need a service that only starts if the current hostname
> matches some value, i.e. only start service on hostA.
>
> or we need to start a service only if some special IP is configured
> on a network interface.
>
> is this already possible without getting a "failed" service?
Hmm, so I think we should make sure that systemd unit files don't become
a programming language. i.e. there needs to be a limit on what we want
to allow to be expressed in unit files. I am tempted to say that checks
like this are probably beyond that limit, and fall into the domain where
shell scripts should be used. I.e. write a tiny shell script that is
executed in ExecStartPre invokes your tool, checks the return code and
then fails if needed.
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list