Vsftpd添加到服务及启动脚本

安装了源码包的vsftpd,启动停止很麻烦所以写了这个脚本。这个脚本不是最新的,最新的那个被我不小心弄没了~~~

步骤:
1)复制内容(因为直接复制可能会有一些字符问题,所以最好是先复制到剪切板,然后在剪切板上看看是否有字符问题,在拷贝到linux系统呢);
2)比如你粘贴后保存的文件为vsftpd,要执行chmod +x vsftpd
3)拷贝他到/etc/init.d/
4)进入到/etc/init.d/,执行chkconfig –add   vsftpd 
5)chkconfig –level 345 vsftpd on
6)使用service vsftpd hlep试试看

#!/bin/bash
# chkconfig: – 20 98
# description: Savas and restores system entropy pool for higher quality randomnumber generation.
#
# Please vsftpd executable file copy to the “/usr/local/sbin/” directory.
# Copy this script to "/etc/init.d/" directory
# Give executable permissions “chmod +x vsftpd”
# Website:
http://www.kinggoo.com

. /etc/rc.d/init.d/functions
prog="vsftpd"
PID=`/sbin/pidof $prog`
#VSFTP_HOME=/usr/local/src/vsftpd-2.3.4
BIN_VSFTP=/usr/local/sbin/vsftpd
STA=$1
start()
{
    if [ ! -z $PID ];then
        echo Service $prog Starting
    else
        echo Startup $prog
        $BIN_VSFTP &
    fi
}
stop()
{
    if [ ! -z $PID ];then
        kill -9 $PID  && echo Service $prog Stopping
        unset PID
    else
         [ "$STA" != "restart" ] && echo Service $prog Stopped
    fi
}

#CASE
case $STA in
start)
    start
    ;;
stop)
    stop
    ;;
   
restart)
    stop
    start
    ;;
status)
    test -z $PID && echo stopping || echo starting
    ;;
*)
    echo $"Usatge: $0 {start|stop|restart|status}"
   
esac

- THE END -
版权声明:
转载原创文章请注明,文章出处://kinggoo.com
原文地址:https://kinggoo.com/chengxu-shell-vsftpdscript.htm
发表评论?

4 条评论。

  1. Good point. I hadn’t thuoght about it quite that way. 🙂

回复给 Luck ¬
取消回复


此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据