I have a DEC VT101 serial terminal hooked up to a Raspberry Pi 3 running Debian using a USB RS-232 null modem cable. When I turn the terminal off, I would like for the shell session to end, and when I turn the terminal back on, I'd like that to start a new login session. How can I do this? Right now, when the terminal is turned off then back on, the screen remains blank until I do something e.g. press Return which will make Bash draw a new prompt.
At the very least, if I could figure out how to query whether there was a system receiving the data from the USB null modem cable, I could script the automatic logging in/out myself. One approach I have in mind would be to send answerback queries to the terminal when there has been no recent user input then assume the terminal is off if I don't get a response after a certain amount of time.