Answer the question
In order to leave comments, you need to log in
How to determine the systemd service that called the bash script to be executed?
Hello, I've run into a small problem. The goal is to set the launch of a script in each of the necessary .service files for the OnFailure event, which will send a notification about the failure of a particular service through the telegram bot. But I ran into a problem, I can’t figure out how to determine in a bash script which service called this script, so that in the message from the bot I could indicate that this or that service has collapsed.
Answer the question
In order to leave comments, you need to log in
cat /proc/$$/status|grep PPid | cut -f 2
get the pid of the parent process.
I don't know about the unit yet.
And who prevents the unit from running the script and passing it the required parameter?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question