I created an update routine for my device. The update process can be started using the serial console, SSH, telnet, a webserver or a REST API. Once the update started, I want to block all user input from all sources until the update is done and the device reboots. Killing SSH, telnet, the webserver and the REST server is easy, but I also want to block the input on the serial console.
So for that I have the following situation:
- The user connects using the serial interface on
- If that shell session is closed, inittab respawns it
- Once the upgrade starts I don't want the user to input anything on the console, so I'd like to block the input for that shell session.
I found that if I
cat /dev/ttyS0 or
cat /dev/console I can "steal" the input away from the shell, thus blocking input. And if I do
(cat /dev/ttyS0 > /dev/null) & I can do that in the background and without seeing the input.
Is this method ok? Is there any reason why I shouldn't do that? Is there any better way?