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

Kyungmin Park kmpark at infradead.org
Thu Jul 11 19:48:24 PDT 2013


On Fri, Jul 12, 2013 at 7:43 AM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Thu, 11.07.13 13:37, Dave Reisner (d at falconindy.com) wrote:
>
>> > +        p = strchr(path, ':');
>>
>> This is going to fail for a file:value pair such as /foo:/bar/baz:value.
>> You could use strrchr(), but then you have to be concerned about
>> matching values with a colon.
>
> This might become a problem, but then again, I think it is OK if some
> files cannot be checked with this. I'd prefer using a space or "=" as
> separator as a better choice though, as that's probably less frequent
> than ":" in the names of files one would check with this condition
> setting.
>
> Lennart
>

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

Thank you,
Kyungmin Park


More information about the systemd-devel mailing list