aboutsummaryrefslogtreecommitdiff
path: root/init.d/local.in
blob: e82d3ccf02a8ec2ef3b4023dc0e6cfe50f930ff8 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!@SBINDIR@/runscript
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.

description="Executes user programs in @SYSCONFDIR@/local.d"

depend()
{
	after *
	keyword -timeout
}

start()
{
	einfo "Starting local"

	local file
	for file in @SYSCONFDIR@/local.d/*.start ; do
		[ -x "$file" ] && "$file"
	done

	if command -v local_start >/dev/null 2>&1; then
		ewarn "@SYSCONFDIR@/conf.d/local should be removed."
		ewarn "Please move the code from the local_start function"
		ewarn "to scripts with an .start extension"
		ewarn "in @SYSCONFDIR@/local.d"
		local_start
	fi

	eend 0
}

stop()
{
	einfo "Stopping local"

	local file
	for file in @SYSCONFDIR@/local.d/*.stop; do
		[ -x "$file" ] && "$file"
	done

	if command -v local_stop >/dev/null 2>&1; then
		ewarn "@SYSCONFDIR@/conf.d/local should be removed."
		ewarn "Please move the code from the local_stop function"
		ewarn "to scripts with an .stop extension"
		ewarn "in @SYSCONFDIR@/local.d"
		local_stop
	fi

	eend 0
}