C, which can receive shutdown / shutdown requests linux / upstart / ubuntu

I have a coded program in C for linux. Right now I am using ubuntu upstart to run as a background service.

I want the program to be gracefully turned off when I commanded instead of just being killed. Can someone point me to the functions used to get such a command?

(edit: I can’t answer my own post, but it seems that I intend to use the signal function signal.h to put callbacks on SIGTERMand SIGKILL).

+3
source share
1 answer

sigaction(2), , SIGTERM.

+4

All Articles