LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to close file handles gracefully during "reboot" command ? (https://www.linuxquestions.org/questions/programming-9/how-to-close-file-handles-gracefully-during-reboot-command-4175495951/)

5883 02-23-2014 11:40 AM

How to close file handles gracefully during "reboot" command ?
 
Hi everyone,

i have a linux embedded system, no NAND flash, only uses SD card for storage.

Our app has several processes, they open database files and consistently working on them.

Now if you press the reset button, or "reboot" cmd from console, the next time we see database file corruption. My guess is our app is not closing file handles gracefully.

Our software reset button gives app a little bit time to clean up, how can i check the opened file handles at this point ? Can i have a separate process and close these file handles in other processes by that file handle hex value ?

Thanks !

NevemTeve 02-23-2014 12:18 PM

No. Your programs have to receive and process signals like SIGINT and SIGTERM, and flush/close their files themselves.


All times are GMT -5. The time now is 06:05 PM.