I'd like to catch a Shutdown done by a user in a Linux terminal, such as:
sudo shutdown
I'm using the following C++ code:
myAct.sa_handler = myStructure::mySignalHandler;
sigaction(mySignal, &act, NULL);
And I'm using a script to send a mySignal
signal.
However, using a script implies to modify the system's main files, and I don't want that.
Is there another solution to catch a shutdown signal via a C++ code in Linux ?