February 4th, 2010, 02:01 PM
Application Cleanup during Linux Shutdown
I'm trying to do some cleanup (write open files) when Linux shuts down. I thought the right method would be to trap SIGTERM and do the necessary processing. Here's my sample code:
When I run this, and press Ctrl-C, it writes "got 2" to test.txt. However, if I logout/reboot, nothing is written to the file.
#include <stdio.h> // for File I/O
#include <signal.h> // for signals
#include <unistd.h> // for sleep()
void handler(int signal)
Any help or ideas would be appreciated!
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!