专注系统运维、网络架构,研究技术凯发app官方网站的解决方案,记录我的思想轨迹、工作学习、生活和关注的领域
分类: 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
很多服务都可以套用这个模板……这样方便了很多