1 Star 0 Fork 14

src-openeuler-fork/nagios

forked from src-openEuler/nagios 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
nagios-0001-default-init.patch 2.49 KB
一键复制 编辑 原始数据 按行查看 历史
fun_yang 提交于 2020-03-16 14:12 . package init
diff -up ./startup/default-init.in.fix_el6_init ./startup/default-init.in
--- ./startup/default-init.in.fix_el6_init 2019-01-15 09:58:00.000000000 -0500
+++ ./startup/default-init.in 2019-02-05 09:38:09.463144849 -0500
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# chkconfig: 345 99 01
+# chkconfig: - 99 01
# description: Nagios network monitor
# processname: nagios
# File : nagios
@@ -24,6 +24,9 @@
# - Clean out redhat macros and other dependencies
# 2003-01-11 Ethan Galstad <[email protected]>
# - Updated su syntax (Gary Miller)
+# 2018-11-28 Justin Paulsen <[email protected]>
+# - Patched for EPEL release of Nagioscore 4.4.2
+# - - nagios-0001-default-init.patch
#
# Description: Starts and stops the Nagios monitor
# used to provide network services status.
@@ -91,12 +94,12 @@ check_config ()
echo "ERROR: Could not delete '$NagiosCfgtestFile'"
exit 8
fi
- if ! su $NagiosUser -c "touch $NagiosCfgtestFile"; then
+ if ! su $NagiosUser -c "touch $NagiosCfgtestFile" -s /bin/sh ; then
echo "ERROR: Could not create or update '$NagiosCfgtestFile'"
exit 8
fi
- TMPFILE=$(mktemp /tmp/.configtest.XXXXXXXX)
+ TMPFILE=$(mktemp $NagiosCfgtestFile.XXX)
$NagiosBin -vp $NagiosCfgFile > "$TMPFILE"
WARN=`grep ^"Total Warnings:" "$TMPFILE" |awk -F: '{print \$2}' |sed s/' '//g`
ERR=`grep ^"Total Errors:" "$TMPFILE" |awk -F: '{print \$2}' |sed s/' '//g`
@@ -138,11 +141,14 @@ status_nagios ()
printstatus_nagios ()
{
- if status_nagios; then
+ status_nagios $1 $2
+ RETVAL=$?
+ if [ $RETVAL = 0 ]; then
echo "nagios (pid $NagiosPID) is running..."
else
echo "nagios is not running"
fi
+ return $RETVAL
}
killproc_nagios ()
@@ -157,7 +163,17 @@ pid_nagios ()
return 1
fi
- NagiosPID=`head -n 1 $NagiosRunFile`
+ export NagiosPID=`head -n 1 $NagiosRunFile`
+ if [[ -z "$NagiosPID" ]]; then
+ echo "No usable PID found in $NagiosRunFile"
+ exit 1
+ fi
+
+ regex='^[0-9]+$'
+ if ! [[ $NagiosPID =~ $regex ]]; then
+ echo "PID not number found in $NagiosRunFile"
+ exit 1
+ fi
}
# Check that nagios exists.
@@ -188,7 +204,7 @@ case "$1" in
fi
fi
- su $NagiosUser -c "touch $NagiosVarDir/nagios.log $NagiosRetentionFile"
+ su $NagiosUser -c "touch $NagiosVarDir/nagios.log $NagiosRetentionFile" -s /bin/sh
@BIN_RM@ -f $NagiosCommandFile
touch $NagiosRunFile
$NagiosBin -d $NagiosCfgFile
@@ -281,6 +297,7 @@ case "$1" in
*)
echo "Usage: nagios {start|stop|restart|reload|force-reload|status|checkconfig|configtest}"
exit 1
+ exit 2
;;
esac
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler-fork/nagios.git
[email protected]:src-openeuler-fork/nagios.git
src-openeuler-fork
nagios
nagios
master

搜索帮助