The OS is a Redhat-clone Linux distribution, I'm using python-2.x.
General code structure is:
# stuff is initialized
while True:
# read stuff from remote devices
# process data
# maybe do stuff, or maybe just watch
os.system("clear")
# display status of remote devices
time.sleep(1)
I want to let the user drive the program by pressing various keys. E.g. "press S to gracefully shutdown remote devices, K to kill, R to restart". All those actions need to happen inside the big loop - the "maybe do stuff, or maybe just watch" comment in my pseudo-code. If no key is pressed, the program should just keep looping.
I'm not sure how to accomplish the keyboard reading within the context of a while True: time.sleep(1) loop.