[systemd-devel] [RFC PATCH] condition: add ConditionFileContains=

Lennart Poettering lennart at poettering.net
Fri Jul 12 06:29:24 PDT 2013


On Fri, 12.07.13 11:48, Kyungmin Park (kmpark at infradead.org) wrote:

> It's another question.
> the main goal of this patch is that supports conditional execution
> If some services are executed with given condition, it should check
> some conditions and execute different flow.
> if [ condition is 1 ]; then
>     launch A service
> else if [ condition is 2 ]; then
>     launch B service
> else
>     launch C service
> 
> current systemd scheme we have to prepare three service file. so can
> we make it only one service with some unit extension? IOW multipul
> unit support?
> 
> [Unit]
> ...
> ConditionBlahBlah=1
> 
> [Unit]
> ...
> ConditionBlahBlah=2
> 
> [Unit]
> ...
> ConditionBlahBlah=!1 && !2 or empty line

Unit files are not supposed to be a Turing complete programming
language, and conditions are suggested only as simple checks for
optimizing start-up of some services. Their configuration files are
independent of each other so that we can load/unload them separately.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list