daemonlib: Update docs
PATCH 1/2 daemonlib: Update docs
Signed-off-by Petr Vorel <[email protected]>
--- doc/test-writing-guidelines.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
doc/test-writing-guidelines.txt +1 -1
@@ -1796,7 +1796,7 @@ correct daemon name. | start_daemon() | Starts daemon, name is passed as first parameter. | stop_daemon() | Stops daemon, name is passed as first parameter. | restart_daemon() | Restarts daemon, name is passed as first parameter. -| status_daemon() | Returns daemon status, TODO: what is return value? +| status_daemon() | Detect daemon status (exit code: 0: running, 1: not running). |============================================================================== .Variables with detected names
Signature · 1 line
2.12.0
PATCH 2/2 daemonlib: Use is-active instead of status for systemctl
'systemctl status service' exit code is broken in old distros. It returns 0 even if service is not running. As we use status_daemon for detecting whether service is running, it's more reliable to use is-active.
systemctl bug was introduced in systemd v209 (f74294c1d), fixed in v213 (5bb75bc74).
Signed-off-by Petr Vorel <[email protected]>
--- testcases/lib/daemonlib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/lib/daemonlib.sh +1 -1
@@ -69,7 +69,7 @@ stop_daemon() status_daemon() { if [ $HAVE_SYSTEMCTL -eq 1 ]; then - systemctl status $1.service > /dev/null 2>&1 + systemctl is-active $1.service > /dev/null 2>&1 elif command -v service >/dev/null 2>&1; then service $1 status > /dev/null 2>&1 else
Signature · 1 line
2.12.0
PATCH 2/2 daemonlib: Use is-active instead of status for systemctl
Hi!
Both pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]