免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 878 | 回复: 1
打印 上一主题 下一主题

[FTP] VSFTPD的init启动脚本 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-07-09 09:24 |只看该作者 |倒序浏览
我安装了vsftpd(源代码安装),但没有找到他的启动脚本,自己改了一个,试了一下可以正常运行。但不知有没有什么潜在的问题,请指教。
  1. #!/bin/bash
  2. #
  3. # Startup script for the Very Secure FTP Server
  4. #
  5. # chkconfig: - 98 13
  6. # description: VSFTPD is a secure FTP server.  
  7. #               
  8. # processname: vsftpd
  9. # pidfile: /var/run/vsftpd.pid
  10. # config: /etc/vsftpd.conf

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

  13. vsftpd=/usr/local/sbin/vsftpd
  14. prog=vsftpd
  15. RETVAL=0

  16. start() {
  17.         # Start daemons.
  18.         if [ -n "`/sbin/pidof $prog`" ]; then
  19.                 echo -n $"$prog: already running"
  20.                   echo
  21.                 return 1
  22.         fi
  23.         echo -n $"Starting $prog: "
  24.         
  25.         # Since vsftpd doesn't return proper exit codes at the moment
  26.         # ,we can't use daemon here - emulate
  27.         # its functionality
  28.         base=$prog
  29.         $vsftpd &
  30.         RETVAL=$?
  31.         usleep 100000
  32.         if [ -z "`/sbin/pidof $prog`" ]; then
  33.                 # The child processes have died after fork()ing
  34.                 RETVAL=1
  35.         fi
  36.         
  37.         [ $RETVAL -ne 0 ] && failure $"$base startup"
  38.         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog && /sbin/pidof $prog >; /var/run/vsftpd.pid && success $"$base startup"
  39.         echo
  40.         return $RETVAL

  41. }
  42. stop() {
  43.         echo -n $"Stopping $prog: "
  44.         killall $vsftpd
  45.         RETVAL=$?
  46.         [ $RETVAL != 0 ] && failure $"$base shutdown" || success $"$base shutdown"
  47.         echo
  48.         [ $RETVAL = 0 ] && rm -f /var/lock/subsys/vsftpd /var/run/vsftpd.pid
  49. }
  50. reload() {
  51.         echo -n $"Reloading $prog: "
  52. #        check13 || exit 1
  53.         killproc $vsftpd -HUP
  54. #        /usr/bin/killall -HUP `/sbin/pidof -o %PPID vsftpd`
  55.         RETVAL=$?
  56.         echo
  57. }

  58. # See how we were called.
  59. case "$1" in
  60.   start)
  61.         start
  62.         ;;
  63.   stop)
  64.         stop
  65.         ;;
  66.   status)
  67.         status $vsftpd
  68.         RETVAL=$?
  69.         ;;
  70.   restart)
  71.         stop
  72.         start
  73.         ;;
  74.   condrestart)
  75.         if [ -f /var/run/vsftpd.pid ] ; then
  76.                 stop
  77.                 start
  78.         fi
  79.         ;;
  80.   reload)
  81.         reload
  82.         ;;
  83.   *)
  84.         echo $"Usage: $prog {start|stop|restart|condrestart|reload|status}"
  85.         exit 1
  86. esac

  87. exit $RETVAL
复制代码

论坛徽章:
0
2 [报告]
发表于 2004-07-09 09:33 |只看该作者

VSFTPD的init启动脚本

可以
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP