#!/bin/sh ### BEGIN INIT INFO # Provides: vsftpd # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Very secure FTP server ### END INIT INFO # /etc/init.d/vsftpd # # Written by Sander Smeenk # Modified by Rogério Brito # Rajout de la possibilité de démarrer vsftpd avec plusieurs fichiers de conf (doivent être de cette forme vsftpd*.conf) set -e for i in $(ls /etc/vsftpd*.conf | awk -F"/" '{print $NF}' | sed 's/.conf//'g) do # Exit if vsftpd.conf doesn't have listen=yes or listen_ipv6=yes # (mandatory for standalone operation) if [ -f /etc/$i.conf ] && ! egrep -iq "^ *listen(_ipv6)? *= *yes" /etc/$i.conf; then exit 0 fi DAEMON=/usr/sbin/vsftpd NAME=$i PATH=/sbin:/bin:/usr/sbin:/usr/bin test -x $DAEMON || exit 0 case "$1" in start) echo -n "Starting FTP server: $NAME" [ -d /var/run/vsftpd ] || mkdir -p /var/run/vsftpd start-stop-daemon --start --background -m --pidfile /var/run/vsftpd/$i.pid --exec $DAEMON -- /etc/$i.conf echo "." ;; stop) echo -n "Stopping FTP server: $NAME" start-stop-daemon --stop --pidfile /var/run/vsftpd/vsftpd.pid --oknodo --exec $DAEMON rm -f /var/run/vsftpd/vsftpd.pid echo "." ;; restart) echo -n "Restarting FTP server: $NAME" start-stop-daemon --stop --pidfile /var/run/vsftpd/vsftpd.pid --oknodo --exec $DAEMON -- /etc/$i.conf rm -f /var/run/vsftpd/vsftpd.pid start-stop-daemon --start --background -m --pidfile /var/run/vsftpd/vsftpd.pid --exec $DAEMON echo "." ;; reload|force-reload) echo "Reloading $NAME configuration files" start-stop-daemon --stop --pidfile /var/run/vsftpd/vsftpd.pid --signal 1 --exec $DAEMON -- /etc/$i.conf echo "." ;; *) echo "Usage: /etc/init.d/vsftpd {start|stop|restart|reload}" exit 1 ;; esac done exit 0