File: //etc/init/ftpd.conf
description "start ftp"
author "Network Infrastructure Team"
console log
start on syno.share.ready and syno.network.ready
stop on runlevel [06]
expect fork
respawn
respawn limit 5 10
pre-start script
if ! [ -x /usr/bin/ftpd ]; then
stop; exit 1
fi
/sbin/initctl emit ftpd-arg-reset
/usr/syno/sbin/synoservicectl --dump-arg ftpd || true
/sbin/initctl emit ftpd-arg-push
eval `/usr/syno/sbin/synoservicectl --dump-arg ftpd` || true
echo "PURE=$PURE" > /tmp/ftpd-upstart-tmp || true
echo "SSL=$SSL" >> /tmp/ftpd-upstart-tmp || true
chmod 755 /tmp/ftpd-upstart-tmp || true
end script
script
. /tmp/ftpd-upstart-tmp || true
if [ "$PURE" == "yes" -a "$SSL" == "yes" ]; then
exec /usr/bin/ftpd -DPS
elif [ "$PURE" == "yes" ]; then
exec /usr/bin/ftpd -DP
elif [ "$SSL" == "yes" ]; then
exec /usr/bin/ftpd -DS
else
exit 1
fi
end script
post-start script
/usr/syno/etc/rc.sysv/avahi.sh ftp-conf || true
rm -f /tmp/ftpd-upstart-tmp || true
end script
post-stop script
if [ -f /var/run/ftpd.pid ]; then
/bin/rm -f /var/run/ftpd.pid
fi
/usr/syno/etc/rc.sysv/avahi.sh avahi-delete-conf || true
end script