I want to be able to send a SIGHUP signal to a Prometheus process from a CI tool that runs with a different user than Prometheus. Let's say CI uses gitlab-runner user and Prometheus uses prometheus user. I thought that I can achieve sending a SIGHUP signal to the Prometheus process by following steps:
- Creating a simple shell script that executes
killcommand:
$ cat `which promhup`
kill -HUP $(pgrep prometheus)
- Change the ownership of this script and set the
setuidbit for this file:
chown prometheus promhup
chmod +x promhup
chmod u+s promhup
Then, I expected that if I simply run promhup, it can send the desired signal to the Prometheus process. However, I get the following error:
/usr/bin/promhup: line 1: kill: (602) - Operation not permitted
The permissions now look like this:
$ ls -l `which promhup`
-rwsr-xr-x 1 prometheus root 51 Jan 27 19:36 /usr/bin/promhup
What have I done wrong? How can I accomplish this without giving a sudo access to my CI user?