I have a shelve
-based Python 3.6 application running on a Linux system with basically this code:
try:
run()
finally:
write_to_db()
When I was developing and stopped it with KeyboardInterrupt
that was fine. Then I decided to run it in the background from a shell script:
#!/bin/bash
nohup ./application &
I also decided to let others test it out.
After a while I realized I needed to add a signal
handler, so I have a way to terminate it properly and handle a server reboot. I've done that, and I've tested it.
The only problem is: Even though it was cleary stated that it was only for testing at his stage, people have (of course) spent a lot of time and effort adding real data in the version without a signal
handler.
So the question is: Can anyone think of a way to salvage that data from memory? I thought sending a SIGINT
would create a KeyboardInterrupt
, but apparently not. Is there any other way to introduce an exception?