mirror of https://github.com/Icinga/icinga2.git
parent
a5a45ae891
commit
bd7b2f30ef
|
@ -29,7 +29,7 @@ if(NOT WIN32)
|
|||
)
|
||||
|
||||
install(
|
||||
FILES prepare-dirs
|
||||
FILES prepare-dirs safe-reload
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/icinga2
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
||||
)
|
||||
|
|
|
@ -108,19 +108,7 @@ stop() {
|
|||
|
||||
# Reload Icinga 2
|
||||
reload() {
|
||||
printf "Reloading Icinga 2: "
|
||||
|
||||
if [ ! -e $ICINGA2_PID_FILE ]; then
|
||||
exit 7
|
||||
fi
|
||||
|
||||
pid=`cat $ICINGA2_PID_FILE`
|
||||
if kill -HUP $pid >/dev/null 2>&1; then
|
||||
echo "Done"
|
||||
else
|
||||
echo "Error: Icinga not running"
|
||||
exit 7
|
||||
fi
|
||||
exec @CMAKE_INSTALL_PREFIX@/lib/icinga2/safe-reload $SYSCONFIGFILE
|
||||
}
|
||||
|
||||
# Check the Icinga 2 configuration
|
||||
|
|
|
@ -8,7 +8,7 @@ EnvironmentFile=@ICINGA2_SYSCONFIGFILE@
|
|||
ExecStartPre=@CMAKE_INSTALL_PREFIX@/lib/icinga2/prepare-dirs @ICINGA2_SYSCONFIGFILE@
|
||||
ExecStart=@CMAKE_INSTALL_FULL_SBINDIR@/icinga2 daemon -d -e ${ICINGA2_ERROR_LOG}
|
||||
PIDFile=@ICINGA2_RUNDIR@/icinga2/icinga2.pid
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
ExecReload=@CMAKE_INSTALL_PREFIX@/lib/icinga2/safe-reload @ICINGA2_SYSCONFIGFILE@
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
# load system specific defines
|
||||
SYSCONFIGFILE=$1
|
||||
if [ -f "$SYSCONFIGFILE" ]; then
|
||||
. $SYSCONFIGFILE
|
||||
else
|
||||
echo "Error: You need to supply the path to the Icinga2 sysconfig file as parameter."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf "Validating config files: "
|
||||
|
||||
OUTPUTFILE=`mktemp`
|
||||
|
||||
if ! $DAEMON daemon --validate --color > $OUTPUTFILE; then
|
||||
echo "Failed"
|
||||
|
||||
cat $OUTPUTFILE
|
||||
rm -f $OUTPUTFILE
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Done"
|
||||
rm -f $OUTPUTFILE
|
||||
|
||||
printf "Reloading Icinga 2: "
|
||||
|
||||
if [ ! -e $ICINGA2_PID_FILE ]; then
|
||||
exit 7
|
||||
fi
|
||||
|
||||
pid=`cat $ICINGA2_PID_FILE`
|
||||
if kill -HUP $pid >/dev/null 2>&1; then
|
||||
echo "Done"
|
||||
else
|
||||
echo "Error: Icinga not running"
|
||||
exit 7
|
||||
fi
|
||||
|
||||
exit 0
|
|
@ -489,6 +489,7 @@ exit 0
|
|||
%config(noreplace) %{_sysconfdir}/%{name}/scripts/*
|
||||
%dir %{_libexecdir}/%{name}
|
||||
%{_libexecdir}/%{name}/prepare-dirs
|
||||
%{_libexecdir}/%{name}/safe-reload
|
||||
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}
|
||||
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata
|
||||
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/tmp
|
||||
|
|
Loading…
Reference in New Issue