Skip to content

Commit ce600ce

Browse files
authored
Merge pull request #10530 from Icinga/kill-drop-permissions
Send signals as Icinga user in safe-reload and logrotate
2 parents 8aafeb4 + 51ec73c commit ce600ce

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

etc/initsystem/safe-reload.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if [ ! -e "$ICINGA2_PID_FILE" ]; then
4343
fi
4444

4545
pid=`cat "$ICINGA2_PID_FILE"`
46-
if ! kill -HUP "$pid" >/dev/null 2>&1; then
46+
if ! "$DAEMON" internal signal --sig SIGHUP --pid "$pid" >/dev/null 2>&1; then
4747
echo "Error: Icinga not running"
4848
exit 7
4949
fi

etc/logrotate.d/icinga2.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
missingok
77
notifempty@LOGROTATE_CREATE@
88
postrotate
9-
/bin/kill -USR1 $(cat @ICINGA2_INITRUNDIR@/icinga2.pid 2> /dev/null) 2> /dev/null || true
9+
@CMAKE_INSTALL_FULL_SBINDIR@/icinga2 internal signal --sig SIGUSR1 --pid "$(cat @ICINGA2_INITRUNDIR@/icinga2.pid 2> /dev/null)" 2> /dev/null || true
1010
endscript
1111
}
1212

lib/cli/internalsignalcommand.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ int InternalSignalCommand::Run(const boost::program_options::variables_map& vm,
5757
return kill(vm["pid"].as<int>(), SIGCHLD);
5858
if (signal == "SIGHUP")
5959
return kill(vm["pid"].as<int>(), SIGHUP);
60+
if (signal == "SIGUSR1")
61+
return kill(vm["pid"].as<int>(), SIGUSR1);
6062

6163
Log(LogCritical, "cli") << "Unsupported signal \"" << signal << "\"";
6264
#else

0 commit comments

Comments
 (0)