I currently have a program that runs at regular intervals. Right now, the program runs continuously, checking for new files every 30 minutes:
def filechecker():
while True:
filechecker()
print '{} : Sleeping...press Ctrl+C to stop.'.format(time.ctime())
time.sleep(1800)
However, I would also like the user to be able to come to the terminal and enter a keystroke manually to call the filechecker () file instead of waiting for the program to wake up or restart the program. Is it possible to do this? I tried to look at the use of threads, but I could not figure out how to wake a computer from sleep (not much experience with threads).
I know that I could just as easily:
while True:
filechecker()
raw_input('Press any key to continue')
for full manual control, but I want me to have my cake and eat it too.