--- rc.single.orig 2009-03-11 01:30:59.000000000 -0200 +++ rc.single 2009-03-11 01:34:40.000000000 -0200 @@ -9,16 +9,16 @@ if [ "$PREVLEVEL" = "3" -o "$PREVLEVEL" = "5" ]; then # Shutdown daemons let i=${#DAEMONS[@]} - while [[ i -gt 0 ]]; do - if [[ $(echo ${DAEMONS[$i]} | /bin/grep '^[^\!]' | /usr/bin/wc -l) -eq 1 ]]; then - /etc/rc.d/${DAEMONS[$i]#@} stop + while [ $i -ge 0 ]; do + if [ "${DAEMONS[$i]:0:1}" != '!' ]; then + ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@} fi let i=i-1 done - # find any leftover daemons and shut them down + # find any leftover daemons and shut them down in reverse order if [ -d /var/run/daemons ]; then - for daemon in $(/bin/ls /var/run/daemons); do - /etc/rc.d/$daemon stop + for daemon in $(/bin/ls -1t /var/run/daemons); do + stop_daemon $daemon done fi fi