红联Linux门户
Linux帮助

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

发布时间:2011-02-28 21:04:37来源:红联作者:fujiefujie
[i=s] 本帖最后由 fujiefujie 于 2011-2-28 21:09 编辑 [/i]

[code]bin/bash
# chkconfig: 2345 99 60
# description: start/stop the zebrad router daemon.
. /etc/init.d/functions

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

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

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

case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "usage:$0:start|stop|status"
esac[/code]
文章评论

共有 2 条评论

  1. fujiefujie 于 2011-02-28 22:13:02发表:

    :0wl;l1:0lopw(1(s):a)

  2. fujiefujie 于 2011-02-28 21:08:29发表:

    [i=s] 本帖最后由 fujiefujie 于 2011-2-28 21:10 编辑 [/i]

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