Browse Source

Simplify the code for stopping daemons listed in pkg_scripts in

reverse order on shutdown.
OK aja@ tb@
OPENBSD_6_2
rpe 7 years ago
parent
commit
a28bfc1508
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      src/etc/rc

+ 7
- 7
src/etc/rc View File

@ -1,4 +1,4 @@
# $OpenBSD: rc,v 1.513 2017/07/18 19:31:20 zhuk Exp $
# $OpenBSD: rc,v 1.514 2017/08/20 19:45:37 rpe Exp $
# System startup script run by init on autoboot or after single-user.
# Output and error are redirected to console by init, and the console is the
@ -337,13 +337,13 @@ if [[ $1 == shutdown ]]; then
if (($(sysctl -n kern.securelevel) == 0)); then
echo 'single user: not running shutdown scripts'
else
pkg_scripts=${pkg_scripts%%*( )}
if [[ -n $pkg_scripts ]]; then
set -A _d -- $pkg_scripts
_i=${#_d[*]}
if ((_i)); then
echo -n 'stopping package daemons:'
while [[ -n $pkg_scripts ]]; do
_d=${pkg_scripts##* }
pkg_scripts=${pkg_scripts%%*( )$_d}
[[ -x /etc/rc.d/$_d ]] && /etc/rc.d/$_d stop
while ((--_i >= 0)); do
[[ -x /etc/rc.d/${_d[_i]} ]] &&
/etc/rc.d/${_d[_i]} stop
done
echo '.'
fi


Loading…
Cancel
Save