Blame SOURCES/vsftpd.init

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