summaryrefslogtreecommitdiff
blob: 939b816a53e52a8f83ee527bccd9f7195fc3aaf0 (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
52
53
54
55
56
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-fs/samba/files/samba-init,v 1.9 2005/03/24 09:28:43 satya Exp $

opts="${opts} reload"

depend() {
	after slapd
	need net
	use cupsd
}

function signal_do {
	local signal
	signal="$1"
	if [ -n "${signal}" ]; then
		result=0
		last_result=0
		for daemon in ${daemon_list}
		do
			cmd=${daemon}_${signal}
			cmd_exec="${!cmd}" 
			if [ -n "${cmd_exec}" ]; then
				ebegin "${my_service_name} -> ${signal}: ${daemon}"
				#echo ${cmd} '->' ${!cmd}
				${cmd_exec} > /dev/null
				last_result=$?
				eend ${last_result}
			fi
			result=$(( ${result} + ${last_result} ))
		done
	fi
	return ${result}
}
start() {
	${my_service_PRE}
	signal_do start
	result_start=$?
	if [ ${result_start} -gt 0 ]; then
		ewarn "Error: stopping services (see system logs)"
		signal_do stop
	fi
	eend ${result_start}
}
stop() {
	${my_service_PRE}
	signal_do stop
	${my_service_POST}
	eend $?
}
reload() {
	${my_service_PRE}
	signal_do reload
	eend $?
}