大家帮忙看看服务启动脚本哪儿出问题了

本帖最后由 fujiefujie 于 2011-2-28 21:09 编辑
  1. bin/bash
  2. # chkconfig: 2345 99 60
  3. # description: start/stop the zebrad router daemon.
  4. . /etc/init.d/functions

  5. start() { echo -n "start the zebra router daemon..."
  6.           /usr/local/sbin/zebra -d
  7.           [ $? -eq 0 ] && echo "ok"
  8.         }

  9. stop() { echo -n "stop the zebra router daemon..."
  10.          kill  -9 `pgrep zebra` &> /dev/null
  11.          [ $? -eq 0 ] && echo "ok"
  12.         }

  13. status() { ps -ef | grep "zebra -d" | grep -v grep  >> /dev/null
  14.           if [ $? -eq 0 ]
  15.           then
  16.                        echo "service zebrad is runnig now."
  17.           else
  18.                        echo "service zebrad is down."
  19.           fi
  20.           }

  21. case $1 in
  22. start)
  23.       start
  24. ;;
  25. stop)
  26.      stop
  27. ;;
  28. restart)
  29.        stop  
  30.        start
  31. ;;
  32. status)
  33.        status
  34. ;;
  35. *)
  36.   echo "usage:$0:start|stop|status"
  37. esac
复制代码

作者: fujiefujie   发布时间: 2011-02-28

本帖最后由 fujiefujie 于 2011-2-28 21:10 编辑

我在执行脚本时出现以下错误:
service zebrad stop  能终止进程,但没有ok信息。而且kill后的内容也显示在前台。
service zebrad restart  只能stop 不能start 。
大家说说到底脚本哪儿出错了???

作者: fujiefujie   发布时间: 2011-02-28

作者: fujiefujie   发布时间: 2011-02-28