Blame SOURCES/vsftpd.init

ac8676
#!/bin/bash
ac8676
#
ac8676
### BEGIN INIT INFO
ac8676
# Provides: vsftpd
ac8676
# Required-Start: $local_fs $network $named $remote_fs $syslog
ac8676
# Required-Stop: $local_fs $network $named $remote_fs $syslog
ac8676
# Short-Description: Very Secure Ftp Daemon
ac8676
# Description: vsftpd is a Very Secure FTP daemon. It was written completely from
ac8676
#              scratch
ac8676
### END INIT INFO
ac8676
ac8676
# vsftpd      This shell script takes care of starting and stopping
ac8676
#             standalone vsftpd.
ac8676
#
ac8676
# chkconfig: - 60 50
ac8676
# description: Vsftpd is a ftp daemon, which is the program \
ac8676
#              that answers incoming ftp service requests.
ac8676
# processname: vsftpd
ac8676
# config: /etc/vsftpd/vsftpd.conf
ac8676
ac8676
# Source function library.
ac8676
. /etc/rc.d/init.d/functions
ac8676
ac8676
# Source networking configuration.
ac8676
. /etc/sysconfig/network
ac8676
ac8676
RETVAL=0
ac8676
prog="vsftpd"
ac8676
ac8676
start() {
ac8676
        # Start daemons.
ac8676
ac8676
	# Check that networking is up.
ac8676
	[ ${NETWORKING} = "no" ] && exit 1
ac8676
ac8676
	[ -x /usr/sbin/vsftpd ] || exit 1
ac8676
ac8676
        if [ -d /etc/vsftpd ] ; then
ac8676
                CONFS=`ls /etc/vsftpd/*.conf 2>/dev/null`
ac8676
                [ -z "$CONFS" ] && exit 6
ac8676
                PROC_FAILED=0
ac8676
                for i in $CONFS; do
ac8676
                        site=`basename $i .conf`
ac8676
                        echo -n $"Starting $prog for $site: "
ac8676
                        daemon /usr/sbin/vsftpd $i
ac8676
                        RETVAL=$?
ac8676
                        echo
ac8676
                        if [ $RETVAL -eq 0 ] && [ ! -f /var/lock/subsys/$prog ]; then
ac8676
                                touch /var/lock/subsys/$prog
ac8676
                        elif [ $RETVAL -ne 0 ]; then
ac8676
                                ps -FC vsftpd | grep "$i" > /dev/null
ac8676
                                RETVAL=$?
ac8676
                                if [ $PROC_FAILED -eq 0 ] && [ $RETVAL -ne 0 ]; then
ac8676
                                        PROC_FAILED=1
ac8676
                                fi
ac8676
                        fi
ac8676
                done
ac8676
                if [ $RETVAL -eq 0 ] && [ $PROC_FAILED -ne 0 ]; then
ac8676
                        RETVAL=1
ac8676
                fi
ac8676
        else
ac8676
                RETVAL=1
ac8676
        fi
ac8676
        return $RETVAL
ac8676
}
ac8676
ac8676
stop() {
ac8676
        # Stop daemons.
ac8676
        echo -n $"Shutting down $prog: "
ac8676
        killproc $prog
ac8676
        RETVAL=$?
ac8676
        echo
ac8676
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
ac8676
        return $RETVAL
ac8676
}
ac8676
ac8676
# See how we were called.
ac8676
case "$1" in
ac8676
  start)
ac8676
        start
ac8676
        ;;
ac8676
  stop)
ac8676
        stop
ac8676
        ;;
ac8676
  restart|reload)
ac8676
        stop
ac8676
        start
ac8676
        RETVAL=$?
ac8676
        ;;
ac8676
  condrestart|try-restart|force-reload)
ac8676
        if [ -f /var/lock/subsys/$prog ]; then
ac8676
            stop
ac8676
            start
ac8676
            RETVAL=$?
ac8676
        fi
ac8676
        ;;
ac8676
  status)
ac8676
        status $prog
ac8676
        RETVAL=$?
ac8676
        ;;
ac8676
  *)
ac8676
        echo $"Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
ac8676
        exit 1
ac8676
esac
ac8676
ac8676
exit $RETVAL