summaryrefslogtreecommitdiff
path: root/package/base-files/src/etc/init.d/rcK
blob: 8bff46cc69c48632b1173eae0b8cd6d9241c584b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
: ${rcquiet=0}
if test x"$rcquiet" = x"0" && sh -n /etc/rc.conf >/dev/null 2>&1; then
	. /etc/rc.conf
	unset rcquiet
	rcquiet=0
else
	unset rcquiet
	rcquiet=1
fi
{
	grep '^#INIT ' /etc/init.d/* | \
	    sort -rnk2 | \
	    while read line; do
		rcenabled=NO
		rcname=${line%%:*}
		rcname=${rcname##*/}
		test x"$rcquiet" = x"0" && eval 'rcenabled=${'"${rcname}"':-NO}'
		test x"$rcenabled" = x"NO" || echo -n "Stopping ${rcname}... "
		sh ${line%%:*} autostop
		rc=$?
		case $rcenabled:$rc in
		(NO:*)
			;;
		(*:0)
			echo done.
			;;
		(*:*)
			echo "failed ($rc)."
			;;
		esac
	done
} | logger -s -p 6 -t ''