分享

nrpe启动脚本

 jas0n_liu 2013-09-12
#!/bin/sh
#This shell script takes care of starting and stopping nrpe.
# description: nrpe is a daemon for a remote nagios server, running nagios plugins on this host.
# processname: nrpe
# config: /usr/local/nagios/etc/nrpe.cfg

# 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

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多