[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [02/05] Embedded with systemd: systemd and different modes



On 17/11/2014 08:40, Andrei POPESCU wrote:
> Just by having a quick look at the manpages, you have all the various 
> Condition* directives (see systemd.unit(5)) and ExecStartPre= (see 
> systemd.service(5)).
> 
> Maybe it would help if you posted your script?

I found the Condition* keywords, but I think my way is easier (I don't
have to add Condition* to all my units) So I have:

checkgpio.service (Requires=multiuser.target, execstart=checkgpio.sh,
type=oneshot remainafterexit=yes )

checkgpio.sh (checks gpio, and executes "systemctl isolate
mode1.target", or "systemctl isolate mode2.target" depending on the
state, then exits.

mode1.target (Wants=service1,service2)

mode2.target (Wants=service2,service3)

So I think is is harder than it should be, but not impossible. Maybe I
am missing something obvious.

Thanks for the input,

Robert


Reply to: