summaryrefslogtreecommitdiffstats
path: root/net/proftpd/files/proftpd.init
blob: b92dc385be58234d0321a26c5d5bacb5f4431621 (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
#!/bin/sh /etc/rc.common
# Copyright (C) 2010 OpenWrt.org

START=50

BIN=/usr/sbin/proftpd
HOME=/home/ftp
RUN_D=/var
PID_F=$RUN_D/proftpd.pid
RUN_USER=ftp
RUN_GROUP=$RUN_USER

EXTRA_COMMANDS="suspend resume"
EXTRA_HELP="	suspend	Suspend the service
	resume	Resume the service"

start() {
	[ -d $HOME ] || ( mkdir -p $HOME && chown $RUN_USER:$RUN_GROUP $HOME )

	[ ! -f $PID_F ] && $BIN
}

stop() {
	[ -f $PID_F ] && kill $(cat $PID_F)
}

reload() {
	[ -f $PID_F ] && kill -HUP $(cat $PID_F)
}

suspend() {
	echo "Suspending NOW"
	ftpshut now "Maintenance in progress"
}

resume() {
	[ -f /etc/shutmsg ] && {
		echo "Allowing sessions again"
		ftpshut -R > /dev/null
	}
}