Proftpd启动脚本

启动服务 
编辑一个启动脚本(这个是proftpd自带的,做了一点小修改) 

    vi /etc/rc.d/init.d/proftpd


#####脚本内容开始########
#!/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
#
# By: Osman Elliyasa <[email protected]>;
# $Id: proftpd.init.d,v 1.7 2002/12/07 21:50:27 jwm Exp $

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

if [ -f /etc/sysconfig/proftpd ]; then
. /etc/sysconfig/proftpd
fi

#下面这行设置环境变量,注意设置好你的proftpd的安装目录
PATH="$PATH:/usr/local/sbin:/var/proftpd/bin:/var/proftpd/sbin"

# See how we were called.
case "$1" in
start)
echo -n "Starting proftpd: "
daemon proftpd $OPTIONS
echo
touch /var/lock/subsys/proftpd
;;
stop)
echo -n "Shutting down proftpd: "
killproc proftpd
echo
rm -f /var/lock/subsys/proftpd
;;
status)
status proftpd
;;
restart)
$0 stop
$0 start
;;
reread)
echo -n "Re-reading proftpd config: "
killproc proftpd -HUP
echo
;;
suspend)
hash ftpshut >;/dev/null 2>;&1
if [ $? = 0 ]; then
if [ $# -gt 1 ]; then
shift
echo -n "Suspending with '$*' "
ftpshut $*
else
echo -n "Suspending NOW "
ftpshut now "Maintanance in progress"
fi
else
echo -n "No way to suspend "
fi
echo
;;
resume)
if [ -f /etc/shutmsg ]; then
echo -n "Allowing sessions again "
rm -f /etc/shutmsg
else
echo -n "Was not suspended "
fi
echo
;;
*)
echo -n "Usage: $0 {start|stop|restart|status|reread|resume"
hash ftpshut
if [ $? = 1 ]; then
echo '}'
else
echo '|suspend}'
echo 'suspend accepts additional arguments which are passed to ftpshut(8)'
fi
exit 1
esac

if [ $# -gt 1 ]; then
shift
$0 $*
fi

exit 0
#######脚本结束#########

按Esc,输入:x保存。 

修改权限,然后添加到系统服务并启动 

chmod +x /etc/rc.d/init.d/proftpd
chkconfig --add proftpd
service proftpd start

以后可以用service proftpd restart来重起proftpd。 

http://www.chinaunix.net/old_jh/15/345782.html

 

 

 

 

 

 

说明:以源码方式编译安装的Proftpd是没有启动脚本的,也就是说用户不能通过简单的Server profptd start/stop/restart等操作。 

为了使用简便,我们建立一个Proftpd的启动脚本,把Proftpd加入系统SysV服务。 

1. 建立启动脚本 

 # vi 
/etc/rc.d/init.d/proftpd
脚本代码: 

 #
!/bin/bashsh
 FTPD_BIN
=/usr/local/proftpd/sbin/proftpd
 FTPD_CONF
=/usr/local/proftpd/etc/proftpd.conf
 PIDFILE
=/usr/local/proftpd/var/proftpd.pid
if [ -f $PIDFILE ]; then
 pid
=`cat $PIDFILE`
 fi
if [ !-x $FTPD_BIN ]; then
 echo 
"$0: $FTPD_BIN: cannot execute"
 exit 
1
 fi
case $1in
 start)
if [ -"$pid" ]; then
 echo 
"$0: proftpd [PID $pid] already running"
 exit
 fi
if [ -r $FTPD_CONF ]; then
 echo 
"Starting proftpd..."
 $FTPD_BIN 
-c $FTPD_CONF
else
 echo 
"$0: cannot start proftpd -- $FTPD_CONF missing"
 fi
 ;;
 stop)
if [ -"$pid" ]; then
 echo 
"Stopping proftpd..."
 kill 
-TERM $pid
else
 echo 
"$0: proftpd not running"
 exit 
1
 fi
 ;;
 restart)
if [ -"$pid" ]; then
 echo 
"Rehashing proftpd configuration"
 kill 
-HUP $pid
else
 echo 
"$0: proftpd not running"
 exit 
1
 fi
 ;;
*)
 echo 
"usage: $0 {start|stop|restart}"
 exit 
1
 ;;
 esac
 exit 
0
注意文件中的 

 FTPD_BIN
=/usr/local/proftpd/sbin/proftpd
 FTPD_CONF
=/usr/local/proftpd/etc/proftpd.conf
 PIDFILE
=/usr/local/proftpd/var/proftpd.pid
三行,如果您的Proftpd不是安装在
/usr/local/proftpd,请根据情况更改以上三行中Proftpd的路径! 

2. 授予proftpd运行权限 

 # chmod 
755/etc/rc.d/init.d/proftpd
3. 将httpd加入系统SysV服务并设置其开机自启动 

 # chkconfig 
--add proftpd
 # chkconfig 
--level 3 proftpd on
这样,今后如需启动、停止、重启Proftpd就可以用以下方式了: 

 # service profptd start
 # service proftpd stop
 # service proftpd restart
 等等……

http://blog.csdn.net/windxxf/article/details/1486732

你可能感兴趣的:(service,service,service,Stop,start,proFTPD,proFTPD,proFTPD,proFTPD,restart)