Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6339046
  • 博文数量: 162
  • 博客积分: 3600
  • 博客等级: 中校
  • 技术积分: 10366
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-19 11:23
个人简介

专注系统运维、网络架构,研究技术解决方案,记录我的思想轨迹、工作学习、生活和关注的领域

文章分类
文章存档

2014年(2)

2013年(16)

2012年(27)

2011年(117)

分类: LINUX

2011-01-29 11:03:39

nrpe自启动脚本

#!/bin/sh
#
# Source function library
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
elif [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/functions ]; then
. /etc/rc.d/functions
fi

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

NrpeBin=/usr/local/nagios/bin/nrpe
NrpeCfg=/usr/local/nagios/etc/nrpe.cfg
LockFile=/var/lock/subsys/nrpe

# See how we were called.
case "$1" in
  start)
 # Start daemons.
 echo -n "Starting nrpe: "
 daemon $NrpeBin -c $NrpeCfg -d
 echo
 touch $LockFile
 ;;
  stop)
 # Stop daemons.
 echo -n "Shutting down nrpe: "
 killproc nrpe
 echo
 rm -f $LockFile
 ;;
  restart)
 $0 stop
 $0 start
 ;;
  status)
 status nrpe
 ;;
  *)
 echo "Usage: nrpe {start|stop|restart|status}"
 exit 1
esac

exit 0

文章转载来自http://hi.baidu.com/xhh_0168/blog/item/586c540877cc1a870b7b822e.html

很多服务都可以套用这个模板……这样方便了很多


阅读(4945) | 评论(0) | 转发(4) |
给主人留下些什么吧!~~