summaryrefslogtreecommitdiffstats
path: root/src/etc/init.d/rc
blob: 9caffe7779713493e05f397b12699d9b262e3b0a (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
#!/bin/sh
#
# /etc/init.d/rc
# Executes init scripts on init and shutdown.
#
# Copyright (C) 2012 Patrick "P. J." McDermott
# This file may be reproduced, distributed, modified, and otherwise dealt in
# under the terms of the Expat/MIT License.

[ -x /usr/bin/logger ] && logger='logger -s -p 6 -t sysinit' || logger=cat

level=${0#*/rc}
case ${level} in
	S)
		action=start
		;;
	K)
		action=stop
		;;
	*)
		exit 1
		;;
esac

for i in /etc/init.d/${level}*; do
	[ -x "${i}" ] && "${i}" ${action} 2>&1
done | ${logger}