summaryrefslogtreecommitdiff
path: root/etc/rc.d/rc.subr
diff options
context:
space:
mode:
authorAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2017-05-28 09:31:46 +0000
committerAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2017-05-28 09:31:46 +0000
commitf7c42a4fb10d25eb74f7b8cb4ecb5fb680559931 (patch)
tree15e58d3d86fe85286f4c641f983333a7e1866f1b /etc/rc.d/rc.subr
parenta5967ef72f204df3adfd74f36d09b41319d5d544 (diff)
When a daemon reaches its timeout when starting, display "timeout" instead
of "ok" so the user is warned and has a chance to fix it (most of the time due to bogus flags). Daemons reaching the timeout without being able to start are still marked as "failed" (which should also give a clue to the user that some investigation is needed). prodded by beck@ a while ago discussed with and ok sthen@
Diffstat (limited to 'etc/rc.d/rc.subr')
-rw-r--r--etc/rc.d/rc.subr8
1 files changed, 5 insertions, 3 deletions
diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr
index 0cf22716063..5ea76459079 100644
--- a/etc/rc.d/rc.subr
+++ b/etc/rc.d/rc.subr
@@ -1,4 +1,4 @@
-# $OpenBSD: rc.subr,v 1.121 2017/05/28 08:38:10 ajacoutot Exp $
+# $OpenBSD: rc.subr,v 1.122 2017/05/28 09:31:45 ajacoutot Exp $
#
# Copyright (c) 2010, 2011, 2014-2017 Antoine Jacoutot <ajacoutot@openbsd.org>
# Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -184,7 +184,7 @@ rc_stop() {
}
rc_cmd() {
- local _n _ret
+ local _msg _n _ret
[ -n "${1}" ] && echo "${_rc_actions}" | grep -qw -- ${1} || _rc_usage
@@ -223,8 +223,10 @@ rc_cmd() {
kill -ALRM ${_TIMERSUB}
wait ${_TIMERSUB} 2>/dev/null # don't print Alarm clock
[[ "${_ret}" == @(0|142) ]] && _rc_do rc_check || break
+ [[ "${_ret}" == 142 ]] && [ X"${rc_bg}" != X"YES" ] &&
+ _msg="timeout"
_rc_do _rc_write_runfile
- _rc_exit ok
+ _rc_exit ${_msg:=ok}
done
# handle failure
type rc_post >/dev/null && _rc_do rc_post