summaryrefslogtreecommitdiff
blob: b8bdfe5e29cd6c67e470c99fe08eb5cc2219813b (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-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/stunnel/files/stunnel.rc6.4.20,v 1.1 2007/12/08 10:38:26 ulm Exp $

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

checkconfig() {
    # To ensure backwards compatibility
    if [ ! -z "$(egrep '/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 --pidfile ${PIDFILE} --quiet --exec /usr/sbin/stunnel -- /etc/stunnel/stunnel.conf  
    eend $?
}

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