Browse Source

Return proper codes so that we don't rc_start if rc_pre failed and we

don't rc_post if rc_stop failed.
"I agree with the direction" sthen@
ok robert@
OPENBSD_5_0
ajacoutot 13 years ago
parent
commit
045e6e479f
1 changed files with 23 additions and 13 deletions
  1. +23
    -13
      src/etc/rc.d/rc.subr

+ 23
- 13
src/etc/rc.d/rc.subr View File

@ -1,4 +1,4 @@
# $OpenBSD: rc.subr,v 1.25 2011/03/10 10:21:39 ajacoutot Exp $
# $OpenBSD: rc.subr,v 1.26 2011/03/14 11:28:44 ajacoutot Exp $
# Default functions and variables used by rc.d(8) scripts.
@ -37,20 +37,30 @@ rc_cmd() {
rc_check >/dev/null
;;
start)
if ! rc_check; then
type rc_pre >/dev/null && rc_pre
rc_start >/dev/null
fi
rc_check || \
(
if type rc_pre >/dev/null; then
rc_pre
fi
[ $? -eq 0 ] && rc_start >/dev/null
)
;;
stop)
rc_stop >/dev/null
i=0
while [ $i -lt 5 ]; do
rc_check || break
sleep 1
i=$((i+1))
done
type rc_post >/dev/null && rc_post || return 0
if rc_check; then rc_stop >/dev/null && \
(
i=0
while [ $i -lt 5 ]; do
rc_check || break
sleep 1
i=$((i+1))
done
if [ $i -lt 5 ]; then
if type rc_post >/dev/null; then \
rc_post
fi
fi
)
fi
;;
reload)
rc_check && rc_reload >/dev/null


Loading…
Cancel
Save