Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1509463
  • 博文数量: 416
  • 博客积分: 10061
  • 博客等级: 上将
  • 技术积分: 3287
  • 用 户 组: 普通用户
  • 注册时间: 2006-12-05 11:12
个人简介

技术在于专研

文章分类

全部博文(416)

文章存档

2021年(3)

2015年(34)

2013年(2)

2012年(1)

2011年(2)

2010年(5)

2007年(344)

2006年(25)

分类: LINUX

2015-01-14 10:24:27

原文地址:nrpe自启动脚本 作者:鸟哥のlinux

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

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


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