[systemd-devel] When System is Degraded

Martin Pitt martin.pitt at ubuntu.com
Mon Jun 6 20:49:59 UTC 2016


Hey Aaron,

Aaron_Wright at selinc.com [2016-06-06 10:27 -0700]:
> I'm using systemd in an embedded device that some some LEDs. I'd like to 
> make an LED red when the system starts up degraded, and green when 
> everything is working normally.
> I'm having a hard time figuring out where to fit this in.
> I tried using a service that runs "systemctl is-system-running" after I've 
> reached my target, but that command returns "starting", obviously.
> What's a better way to run a command when the system is "running" vs 
> "degraded"?

Try adding a .service with "Type=idle" and add it to your default
target (usually multi-user.target). This should run the unit after the
system is booted (i. e. running or degraded).

(Tested here with systemd 230)

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)


More information about the systemd-devel mailing list