summaryrefslogtreecommitdiff
blob: 3708a1c0dbca452a3cfa199dcdee75b483713fa6 (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
#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

# Default pidfile location
PIDFILE="/var/run/stunnel/stunnel.pid"

checkconfig() {
	# To ensure backwards compatibility
	if grep -q /etc/stunnel/stunnel.pid /etc/stunnel/stunnel.conf; then
		ewarn "Please update your stunnel.conf!"
		ewarn "pid should point to /var/run/stunnel/stunnel.pid"
		PIDFILE="/etc/stunnel/stunnel.pid"
	fi
}

depend() {
	need net
}

start() {
	checkconfig
	ebegin "Starting stunnel"
	start-stop-daemon --start --quiet --pidfile "${PIDFILE}" \
		--exec /usr/bin/stunnel -- /etc/stunnel/stunnel.conf
	eend $?
}

stop() {
	checkconfig
	ebegin "Stopping stunnel"
	start-stop-daemon --stop --quiet --pidfile "${PIDFILE}"
	eend $?
}