summaryrefslogtreecommitdiff
path: root/skip/samba/samba.initd
blob: 71c7fb2c6f6c08f1e5e54a3639d2c37c68ff0b6a (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/sbin/openrc-run

extra_started_commands="reload"
piddir=${piddir:-"/run/samba"}

DAEMON=${RC_SVCNAME#samba.}
if [ "$DAEMON" != "$RC_SVCNAME" ]; then
	daemon_list=$DAEMON
fi

depend() {
	need net
	after firewall
}

start_pre() {
	checkpath --directory "$piddir"
}

start_samba() {
	start-stop-daemon --start --quiet --exec /usr/sbin/samba -- \
		${samba_options:-"-D"}
}

stop_samba() {
	start-stop-daemon --stop --quiet --pidfile "$piddir"/samba.pid
}

start_smbd() {
	start-stop-daemon --start --quiet --exec /usr/sbin/smbd -- \
		${smbd_options:-"-D"}
}

stop_smbd() {
	start-stop-daemon --stop --quiet --pidfile "$piddir"/smbd.pid
}

start_nmbd() {
	start-stop-daemon --start --quiet --exec /usr/sbin/nmbd -- \
		${nmbd_options:-"-D"}
}

stop_nmbd() {
	start-stop-daemon --stop --quiet --pidfile "$piddir"/nmbd.pid
}

start_winbindd() {
	start-stop-daemon --start --quiet --exec /usr/sbin/winbindd -- \
		$winbindd_options
}

stop_winbindd() {
	start-stop-daemon --stop --quiet --pidfile "$piddir"/winbindd.pid
}

start() {
	for i in $daemon_list; do
		ebegin "Starting $i"
		start_$i
		eend $?
	done
}

stop() {
	for i in $daemon_list; do
		ebegin "Stopping $i"
		stop_$i
		eend $?
	done
}

reload() {
	for i in $daemon_list; do
		ebegin "Reloading $i"
		killall -HUP $i
		eend $?
	done
}