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

Łukasz Stelmach l.stelmach at samsung.com
Fri Jul 12 01:16:43 PDT 2013

It was <2013-07-11 czw 19:18>, when Karol Lewandowski wrote:
> Add ability to test if given file contains specified value.
> File and expected value are given as one argument separated
> by colon (":"), i.e.
>   ConditionFileContains=/sys/module/sn/parameters/enabled:1
> ---
> As above example suggests we use it to conditionally
> start service based on kernel module parameter value.
> This can be (ab)used for other/regular files too.

I am confused a bit. Although I can see (hardly though) the point but
I am not sure, yet another condition in unit files is required. IMHO
systemd can check if files required by a service exist (and some other
tests which more or less cover test(1) functions) and not lauch the
service if they does not but, it is up to the service to check the
files' contents. No matter if it is a single character or a 24Mpix jpeg

Technically, except for the notes already given by others, the patch
does not look bad.

Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics

More information about the systemd-devel mailing list