Current Path : /etc/rc6.d/ |
|
Current File : //etc/rc6.d/K15pure-ftpd |
#!/bin/bash
#
# Startup script for the pure-ftpd FTP Server $Revision: 1.3 $
#
# chkconfig: 2345 85 15
# description: Pure-FTPd is an FTP server daemon based upon Troll-FTPd
# processname: pure-ftpd
# pidfile: /var/run/pure-ftpd.pid
# config: /etc/pure-ftpd.conf
# RedHat or Suse?
if [ -e "/etc/SuSE-release" ]; then
SUSE=1
DAEMONIZE=''
RESULT='done'
else
REDHAT=1
DAEMONIZE='daemon'
RESULT=''
fi
if [ "$REDHAT" = "1" ]; then
# Source function library.
if [ -e "/etc/init.d/functions" ]; then
. /etc/init.d/functions
else
if [ -e "/etc/rc.d/init.d/functions" ]; then
. /etc/rc.d/init.d/functions
fi
fi
fi
if [ "$SUSE" = "1" ]; then
# Source rc status functions
. /etc/rc.status
fi
RETVAL=0
# Path to the pure-ftp binaries.
prog=pure-config.pl
stat=pure-ftpd
fullpath=/usr/sbin/$prog
pureftpwho=/usr/sbin/pure-ftpwho
pureftpauthd=/usr/sbin/pure-authd
start() {
echo -n "Starting $prog: "
$DAEMONIZE $fullpath /etc/pure-ftpd.conf $OPTIONS --daemonize
RETVAL=$?
[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
echo $RESULT
echo -n "Starting pure-authd: "
$pureftpauthd -s /var/run/ftpd.sock -r /usr/local/cpanel/bin/pureauth &
RETVAL=0
[ $RETVAL = 0 ] && touch /var/lock/subsys/pure-authd
echo $RESULT
}
stop() {
# file exists and is not empty
if [ -s /var/run/pure-ftpd.pid ]; then
echo -n "Stopping $prog: "
kill $(cat /var/run/pure-ftpd.pid)
RETVAL=$?
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog
echo $RESULT
fi
echo -n "Stopping pure-authd: "
/usr/local/cpanel/scripts/ckillall -9 pure-authd
RETVAL=0
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/pure-authd
echo $RESULT
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/lock/subsys/$prog ] ; then
stop
# avoid race
sleep 3
start
fi
;;
status)
status $stat
RETVAL=$?
if [ -f $pureftpwho ] && [ $RETVAL -eq 0 ] ; then
$pureftpwho
fi
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|status}"
RETVAL=1
esac
exit $RETVAL
Copyright 2K16 - 2K18 Indonesian Hacker Rulez