#!/usr/bin/execlineb -P
# proftpd in foreground (-n), matching debian/sv/proftpd.
# Fail longrun if --configtest fails (runit uses exit 162).

envfile -I /etc/default/proftpd
importas -sCuD "/etc/proftpd/proftpd.conf" CONFIG_FILE CONFIG_FILE
importas -sCuD "" OPTIONS OPTIONS
envfile -I /etc/s6-rc/config/proftpd.conf
importas -sCuD "-n" Args Args

foreground { mkdir -p /run/proftpd }

foreground { /usr/sbin/proftpd -c ${CONFIG_FILE} --configtest }

fdmove -c 2 1
exec /usr/sbin/proftpd ${Args} -c ${CONFIG_FILE} ${OPTIONS}
