Re: [systemd-devel] When System is Degraded

2016-06-07 Thread Aaron_Wright
Lennart Poettering  wrote on 06/07/2016 02:44:18 
AM:
> aaron_wri...@selinc.com wrote:
> > What's a better way to run a command when the system is "running" vs 
> > "degraded"?
> 
> Hmm, that's a very good question.
> 
> Other than suggesting to write a small service that waits for the
> StartupFinished bus signal I have no good suggestion I fear. That
> service could start any time, would just wait for the signal, and do
> what you want it to do, and exit then...
> 
> Lennart
> 
> -- 
> Lennart Poettering, Red Hat

That's pretty much what I ended up with. 

Though I wanted the service to hang around so that it could continually 
monitor the system. So if the system becomes degraded at any point, the 
LED will turn red (and vise-versa).

Thanks___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] When System is Degraded

2016-06-07 Thread Lennart Poettering
On Mon, 06.06.16 10:27, aaron_wri...@selinc.com (aaron_wri...@selinc.com) wrote:

> 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"?

Hmm, that's a very good question.

Other than suggesting to write a small service that waits for the
StartupFinished bus signal I have no good suggestion I fear. That
service could start any time, would just wait for the signal, and do
what you want it to do, and exit then...

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] When System is Degraded

2016-06-06 Thread Martin Pitt
Hey Aaron,

aaron_wri...@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)
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] When System is Degraded

2016-06-06 Thread Aaron_Wright
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"?___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel