Chinaunix首页 | 论坛 | 博客
  • 博客访问: 623092
  • 博文数量: 73
  • 博客积分: 1813
  • 博客等级: 上尉
  • 技术积分: 1213
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-27 19:59
文章分类
文章存档

2013年(1)

2012年(12)

2011年(28)

2010年(31)

2009年(1)

我的朋友

分类: LINUX

2010-08-06 10:40:23

#########################################################################
cat /etc/init.d/nrped
#!/bin/sh
nrpe_num=`ps aux | grep /bin/nrpe | grep -v grep | wc -l`
case $1 in
  start)
    if [ $nrpe_num -eq 1 ]
    then
       echo "Error:nrpe is running."
    else
       /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
       echo "nrpe started successfully."
    fi
  ;;
  stop)
    if [ $nrpe_num -eq 1 ]
    then
       nrpe_pid=`ps aux | grep /bin/nrpe | grep -v grep | awk '{print $2}'`
       kill -9 $nrpe_pid
       echo "nrpe stoped successfully."
    else
       echo "Error:nrpe is stoping."
    fi
  ;;
  restart)
    if [ $nrpe_num -eq 1 ]
    then
       nrpe_pid=`ps aux | grep /bin/nrpe | grep -v grep | awk '{print $2}'`
       kill -9 $nrpe_pid
       echo "nrpe stoped successfully."
       /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
       echo "nrpe started successfully."
    else
       echo "Error:nrpe is stoping"
       /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
       echo "nrpe started successfully."
    fi
esac
########################################################################
阅读(2672) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~