|
|
@ -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 |
|
|
|