Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 976aeacbdb50a0541a053b760df66615 > files > 7

proftpd-1.3.1-11mdv2008.1.x86_64.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
	gprintf "Starting %s" "$NAME"
	daemon "proftpd" 2>/dev/null
	RETVAL=$?
	[ $RETVAL -eq 0 ] && touch $LOCKFILE
	echo
    fi
}

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

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

suspend() {
    if [ $# -gt 1 ]; then
	shift
	gprintf "Suspending proftpd with '$*' "
	$FTPSHUT $*
    else
	gprintf "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
	gprintf "Allowing proftpd sessions again "
	rm -f /etc/shutmsg
    else
	gprintf "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
	;;
    *)
	gprintf "Usage: %s {start|stop|status|restart|condrestart|reload|resume|suspend} [time]" "$0"
	exit 1
esac

exit $RETVAL