diff options
Diffstat (limited to 'net-dialup/accel-ppp/files/accel-ppp.initd')
-rw-r--r-- | net-dialup/accel-ppp/files/accel-ppp.initd | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/net-dialup/accel-ppp/files/accel-ppp.initd b/net-dialup/accel-ppp/files/accel-ppp.initd index d3f3891cd7a0..fd9cbad07caa 100644 --- a/net-dialup/accel-ppp/files/accel-ppp.initd +++ b/net-dialup/accel-ppp/files/accel-ppp.initd @@ -1,5 +1,5 @@ #!/sbin/runscript -# Copyright 1999-2013 Gentoo Foundation +# Copyright 1999-2016 Gentoo Foundation # Distributed under the terms of the GNU General Public License, v2 or later # $Id$ @@ -9,45 +9,31 @@ depend() { need net } -check_dir() { -# Check for directory existance, try to create it(if it's not exist yet) -# and throw error if it can not be done. -# Parameters: -# $1 - directory to check -# $2 - error message - if [[ ! -d $1 ]]; then - mkdir "$1" 2>/dev/null - if [[ $? != 0 ]]; then - eerror "$2" - exit 1 - fi - fi -} - -start() { +start_pre() { # Create directory for PID file - local piddir=$(dirname ${PID}) - check_dir "${piddir}" "Can not create directory $piddir for PID file" + checkpath -d -q "$(dirname ${ACCEL_PPPD_PID})" # Create default directory for radius attributes - check_dir "${RADATTR_DIR}" "Can not create directory ${RADATTR_DIR} 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 ${PID} + start-stop-daemon --start --quiet --exec /usr/sbin/accel-pppd -- ${ACCEL_PPPD_OPTS} -p ${ACCEL_PPPD_PID} eend $? } stop() { ebegin "Stopping accel-pppd" - start-stop-daemon --stop --quiet --pidfile ${PID} + start-stop-daemon --stop --quiet --pidfile ${ACCEL_PPPD_PID} eend $? } reload() { - if [ ! -f ${PID} ]; then + if [ ! -f ${ACCEL_PPPD_PID} ]; then eerror "accel-pppd isn't running" return 1 fi ebegin "Reloading configuration" - start-stop-daemon --signal USR1 --pidfile ${PID} + start-stop-daemon --signal USR1 --pidfile ${ACCEL_PPPD_PID} eend $? } |