下面我们在/etc/init.d/ 下编写一个实现service和chkconfig系统控制httpd开启关闭的脚本ftp:(和昨天的差不多,别忘了变成可执行的 chmod a+x ftp)
echo -n "vsftpd is starting...."
sleep 1
$VSFTPD &
[ $? -eq 0 ] &&touch /var/lock/subsys/ftp && echo -e "It is \033[31m OK \033[0m" || echo -e "It is \033[31m FAIL \033[0m"
echo -n "vsftpd is stoping...."
sleep 1
killproc vsftpd && rm -rf /var/lock/subsys/ftp || echo -e "It is \033[31m FAIL \033[0m "
[ -f /var/lock/subsys/ftp ] && echo "vsftpd is runing" && exit
stop
start
start )
start
;;
stop )
stop
;;
restart )
restart
;;
* )
echo "Usag: start|stop|restart"
;;
esac
还有一点别忘了
chkconfig --add ftp