Good afternoon, I ran into a small problem.The purpose of this is in each of the necessary .service files for the OnFailure event to put the launch of a script that will send notification of the failure of a service through a telegram bot.But I ran into a problem, I can’t understand In the bash script, determine which service caused this script, so that you can indicate in the message from the bot that one or another service crashed.

2 Answers 2

northernlightlabs.se/systemd.status.mail.on.unit.f...
  • Thank you, just what you need! – Creepy61 Apr 27 '17 at 12:49
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 you from running the script in a unit and passing the necessary parameter to it?
  • Thanks for the tip, passing the parameter is really a solution) – Creepy61 Apr 27 '17 at 11:52