Nagios和ndo2db系统脚本—for gentoo

Gentoo下Nagios系统启动脚本

#!/sbin/runscript
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
depend() {
need net
}
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
fi
checkconfig() {
nagios_bin_file=/var/www/localhost/htdocs/nagios/bin/nagios
nagios_cfg_file=/var/www/localhost/htdocs/nagios/etc/nagios.cfg
if [ ! -f "$nagios_bin_file" ]; then
echo "$nagios_bin_file is not exist."
exit 1
fi
if [ ! -f "$nagios_cfg_file" ]; then
echo "$nagios_cfg_file is not exist."
exit 1
fi
$nagios_bin_file -v $nagios_cfg_file > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "please check your nagios configuration file."
exit 1
fi
}
start() {
nagios_script_file=/var/www/localhost/htdocs/nagios/sbin/nagios
checkconfig
ebegin "starting nagios"
start-stop-daemon --start --exec $nagios_script_file
eend $?
}
stop() {
nagios_pid_file=/var/www/localhost/htdocs/nagios/var/nagios.lock
ebegin "Stopping nagios"
start-stop-daemon --stop --retry 30 --pidfile $nagios_pid_file
eend $?
}
status() {
nagios_run_path=/var/www/localhost/htdocs/nagios/var
if [ ! -f $nagios_run_path/nagios.lock ]; then
echo "nagios is not running."
else
nagios_pid_NO=`head -n 1 $nagios_run_path/nagios.lock`
echo "nagios( pid:$nagios_pid_NO ) is running."
fi
}

Gentoo下ndo2db系统启动脚本

#!/sbin/runscript
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
depend() {
need net
}
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
fi
checkconfig() {
ndo2db_bin_file=/var/www/localhost/htdocs/nagios/bin/ndo2db-3x
ndo2db_cfg_file=/var/www/localhost/htdocs/nagios/etc/ndo2db.cfg
if [ ! -f "$ndo2db_bin_file" ]; then
echo "$ndo2db_bin_file is not exist."
exit 1
fi
if [ ! -f "$ndo2db_cfg_file" ]; then
echo "$ndo2db_cfg_file is not exist."
exit 1
fi
}
start() {
ndo2db_script_file=/var/www/localhost/htdocs/nagios/sbin/ndo2db
checkconfig
ebegin "starting ndo2db"
start-stop-daemon --start --exec $ndo2db_script_file
eend $?
}
stop() {
ndo2db_pid_file=/var/www/localhost/htdocs/nagios/var/ndo2db.lock
ebegin "Stopping ndo2db"
start-stop-daemon --stop --retry 30 --pidfile $ndo2db_pid_file
eend $?
}
status() {
ndo2db_run_path=/var/www/localhost/htdocs/nagios/var
if [ ! -f $ndo2db_run_path/ndo2db.lock ]; then
echo "ndo2db service is not running."
else
ndo2db_pid_NO=`head -n 1 $ndo2db_run_path/ndo2db.lock`
echo "ndo2db( pid:$ndo2db_pid_NO ) is running."
fi
}

 

文章版权声明

 1 原创文章作者:572654062,如若转载,请注明出处: https://www.52hwl.com/34032.html

 2 温馨提示:软件侵权请联系469472785#qq.com(三天内删除相关链接)资源失效请留言反馈

 3 下载提示:如遇蓝奏云无法访问,请修改lanzous(把s修改成x)

 免责声明:本站为个人博客,所有软件信息均来自网络 修改版软件,加群广告提示为修改者自留,非本站信息,注意鉴别

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023年7月15日 上午9:34
下一篇 2023年7月15日 上午9:34