I have a program that spends a lot of time asleep in an endless loop, it checks in with another system API every 6 hours, and if there are changes does some stuff, if not goes back to sleep.
Without listing all the code, its pretty simple; I have
while True:
do some stuff
time.sleep(21600)
The only way to break this is with CTRL+C, but that seems ugly, is there a way to make another keypess interrupt the time.sleep() and use a graceful sys.exit()?