Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates-src > by-pkgid > 66cf70cb4b27fe034994d790dba13f43 > files > 19

proftpd-1.3.5e-4.2.mga7.src.rpm

#!/bin/sh
#
# Startup script for ProFTPd
#
# chkconfig: 345 85 15
# Description: ProFTPD is an enhanced FTP server with \
#               a focus toward simplicity, security, and ease of configuration. \
#               It features a very Apache-like configuration syntax, \
#               and a highly customizable server infrastructure, \
#               including support for multiple 'virtual' FTP servers, \
#               anonymous FTP, and permission-based directory visibility.
# processname: proftpd
# config: /etc/proftpd.conf
#
### BEGIN INIT INFO
# Provides: proftpd
# Required-Start: $network
# Required-Stop: $network
# Should-Start: mysqld postgresql radiusd ldap
# Should-Stop: mysqld postgresql radiusd ldap
# Default-Start: 3 4 5
# Short-Description: ProFTPD FTP server
# Description: ProFTPD is an enhanced FTP server with
#              a focus toward simplicity, security, and ease of configuration.
#              It features a very Apache-like configuration syntax,
#              and a highly customizable server infrastructure,
#              including support for multiple 'virtual' FTP servers,
#              anonymous FTP, and permission-based directory visibility.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

# source network configuration
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

NAME=proftpd
FTPSHUT=/usr/sbin/ftpshut
LOCKFILE=/var/lock/subsys/$NAME
RETVAL=0

start() {
    # Check if it is already running
    if [ ! -f $LOCKFILE ]; then
	echo -n "Starting $NAME"
	daemon "proftpd" 2>/dev/null
	RETVAL=$?
	[ $RETVAL -eq 0 ] && touch $LOCKFILE
	echo
    fi
}

stop() {
    echo -n "Stopping $NAME"
    killproc proftpd
    RETVAL=$?
    [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
    echo
}

reload() {
    echo -n "Reloading $NAME"
    killproc proftpd -HUP
    RETVAL=$?
    echo
}

suspend() {
    if [ $# -gt 1 ]; then
	shift
	echo -n "Suspending proftpd with '$*' "
	$FTPSHUT $*
    else
	echo -n "Suspending proftpd NOW "
	$FTPSHUT now "Maintenance in progress"
    fi
    killproc proftpd
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
}

resume() {
    if [ -f /etc/shutmsg ]; then
	echo -n "Allowing proftpd sessions again "
	rm -f /etc/shutmsg
    else
	echo -n "Starting proftpd; was not suspended "
	fi
    daemon "proftpd >/dev/null 2>&1"
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch $LOCKFILE
}

# See how we were called.
case "$1" in
    start)
	start
	;;
    stop)
	stop
	;;
    status)
	status proftpd
	RETVAL=$?
	;;
    restart)
	stop
	start
	;;
    condrestart)
	if [ -f $LOCKFILE ]; then
	    stop
	    start
	fi
	;;
    reload)
	reload
	;;
    suspend)
	suspend
  	;;
    resume)
	resume
	;;
    *)
	echo -n "Usage: $0 {start|stop|status|restart|condrestart|reload|resume|suspend} [time]"
	exit 1
esac

exit $RETVAL