nrpe自启动脚本

post by rocdk890 / 2013-1-7 10:57 Monday linux技术
#!/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
------------------------------------------------------
# chkconfig --add nrpe
# chkconfig nrpe on
# service nrpe restart
夜空- 本站版权
1、本站所有主题由该文章作者发表,该文章作者与夜空享有文章相关版权
2、其他单位或个人使用、转载或引用本文时必须同时征得该文章作者和夜空的同意
3、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责
4、如本帖侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意
5、原文链接:blog.slogra.com/post-309.html

标签: 启动 脚本 自启动 nagios nrpe

评论: