开发者

C program that can receive shutdown/terminate requests from linux/upstart/ubuntu

I have a coded a program in C for linux. At the moment I am using ubuntu upstart to run as a background service.

I want to be able to have the program gracefully shutdown when commanded instead of just being killed off. Can someone please point me to the functions used to receive such a command?

(edit: can't answer own post but it seems I am meant to use signal.h signal fun开发者_StackOverflow中文版ction to put callbacks on SIGTERM and SIGKILL).


You want to use sigaction(2) to define a handler to be run when SIGTERM is caught.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜