summaryrefslogtreecommitdiff
blob: ae8978fe9cda19abd28b0398cd0feebaa69d8746 (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
#!/sbin/runscript
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-ftp/proftpd/files/proftpd.rc7,v 1.1 2009/09/08 16:27:22 voyageur Exp $

opts="reload"

depend() {
	need net
	use dns
}

check_configuration() {
	if [ ! -e /etc/proftpd/proftpd.conf ] ; then
		eerror "To execute the ProFTPD server you need a /etc/proftpd/proftpd.conf configuration"
		eerror "file. In /etc/proftpd you can find a sample configuration."
		return 1
	fi
	ebegin "Checking ProFTPD configuration"
	/usr/sbin/proftpd -t -c /etc/proftpd/proftpd.conf
	eend $? "A configuration error was found. You have to fix your configuration file."
}

start() {
	if [ "${RC_CMD}" != "restart" ] ; then
		check_configuration || return 1
	fi
	ebegin "Starting ProFTPD"
	start-stop-daemon --start --quiet \
		--exec /usr/sbin/proftpd \
		--pidfile /var/run/proftpd/proftpd.pid
	eend $?
}

stop() {
	if [ "${RC_CMD}" = "restart" ] ; then
		check_configuration || return 1
	fi
	ebegin "Stopping ProFTPD"
	start-stop-daemon --stop --quiet --retry 20 \
		--pidfile /var/run/proftpd/proftpd.pid
	eend $?
}

reload() {
	if [ ! -f /var/run/proftpd/proftpd.pid ] ; then
		eerror "ProFTPD is not running."
		return 1
	fi
	check_configuration || return 1
	ebegin "Reloading ProFTPD"
	kill -HUP `cat /var/run/proftpd/proftpd.pid` &>/dev/null
	eend $?
}