On Thu, 25 Jan 2018, Kevin Hsu wrote:
Hi folks,
"systemctl is-active" command gives "inactive" no matter the unit exists
and indeed inactive or it just not exist. This behavior is semantically
true since a unit can never be active
if it does not exist. But "systemctl is-enabled" command will give a clear
result "Failed to get unit file state for no-exist.service: No such file or
directory" to indicate user the existence
of the given unit. I am wondering if "systemctl is-active" should behave
the same.
I don't think it would be possible to change what "systemctl is-active"
prints out now, and I think it makes sense for it to track the ActiveState
property of the unit precisely.
You can get the properties of a unit using "systemctl show". For example:
$ systemctl show --property LoadState,ActiveState,SubState \
does-not-exist.service
LoadState=not-found
ActiveState=inactive
SubState=dead
As you can see here, what you're interested in is the "load state" of the
unit, which is somewhat orthogonal to the unit's "active state".
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel