You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/net-ftp/pure-ftpd/files/pure-ftpd.rc11

76 lines
2.0 KiB

#!/sbin/openrc-run
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
ftpd_pidfile="/var/run/pure-ftpd.pid"
script_pidfile="/var/run/pure-uploadscript.pid"
ftpd_rundir="/var/lib/run/pure-ftpd"
daemon="/usr/sbin/pure-ftpd"
script_daemon="/usr/sbin/pure-uploadscript"
depend() {
need localmount
use netmount
}
start_pre() {
if [ -z "${IS_CONFIGURED}" ] ; then
eerror "You need to setup /etc/conf.d/pure-ftpd first!"
return 1
fi
}
start() {
UPSCRIPT=""
if [ -n "${UPLOADSCRIPT}" ] ; then
UPSCRIPT="--uploadscript"
fi
FTPD_CONFIG="$SERVER $MAX_CONN $MAX_CONN_IP $DISK_FULL $USE_NAT $AUTH
$LOG $TIMEOUT $CHARCONV $MISC_OTHER $UPSCRIPT"
WAIT="--wait 100"
if ${TMPFS_MOUNT:-false} && grep -q tmpfs /proc/filesystems ; then
[ -n "${TMPFS_OPTS}" ] && MOUNT_OPTS="-o ${TMPFS_OPTS}"
einfo "Mounting tmpfs on ${ftpd_rundir}"
mount ${MOUNT_OPTS} -t tmpfs tmpfs ${ftpd_rundir} \
|| eerror "Unable to mount tmpfs"
fi
ebegin "Starting Pure-FTPd"
start-stop-daemon --start --quiet --pidfile ${ftpd_pidfile} \
--make-pidfile --background --exec /usr/sbin/pure-ftpd ${WAIT} \
-- $(echo ${FTPD_CONFIG} | sed 's@\([[:space:]]\+\|^\)-B\([[:space:]]\+\|$\)@\1@g')
result=$?
if [ ${result} -ne 0 ] ; then
eend 1 "Could not launch Pure-FTPd"
else
eend $result
if [ -n "${UPLOADSCRIPT}" ] ; then
ebegin "Starting Pure-FTPd upload script"
start-stop-daemon --start --quiet --make-pidfile \
--pidfile ${script_pidfile} \
--exec ${script_daemon} --background ${WAIT} \
-- -r $UPLOADSCRIPT
eend $?
fi
fi
}
stop() {
if [ -n "${UPLOADSCRIPT}" ] ; then
ebegin "Stopping Pure-FTPd upload script"
start-stop-daemon --stop --retry 20 --quiet \
--pidfile ${script_pidfile}
eend $?
fi
ebegin "Stopping Pure-FTPd"
start-stop-daemon --stop --retry 20 --quiet --pidfile ${ftpd_pidfile}
eend $?
if ${TMPFS_MOUNT:-false} && mount | grep -q ${ftpd_rundir} ; then
umount ${ftpd_rundir} >/dev/null 2>&1
fi
}