summaryrefslogtreecommitdiff
path: root/net-dialup/accel-ppp/files/accel-ppp.initd
blob: df98efbc8db0188a45c1ec85c030d17894b3dffe (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
#!/sbin/runscript
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Id$

extra_started_commands="reload"

depend() {
	need net
}

start_pre() {
	# Create directory for PID file
	checkpath -d -q "$(dirname ${ACCEL_PPPD_PID})"
	# Create default directory for radius attributes
	checkpath -d -q "${RADATTR_DIR}"
}

start() {
	ebegin "Starting accel-pppd"
	start-stop-daemon --start --quiet --exec /usr/sbin/accel-pppd -- ${ACCEL_PPPD_OPTS} -p ${ACCEL_PPPD_PID}
	eend $?
}

stop() {
	ebegin "Stopping accel-pppd"
	accel-cmd shutdown
	[ $? -ne 0 ] && kill -9 $(pidof accel-pppd)
	PID="$(cat ${ACCEL_PPPD_PID})"
	while [ -n "${PID}" -a -d "/proc/${PID}" ]; do
		sleep 1
	done
	rm -f ${ACCEL_PPPD_PID}
	eend 0
}

reload() {
	if [ ! -f ${ACCEL_PPPD_PID} ]; then
		eerror "accel-pppd isn't running"
		return 1
	fi
	ebegin "Reloading configuration"
	start-stop-daemon --signal USR1 --pidfile ${ACCEL_PPPD_PID}
	eend $?
}