Consider a headless device that uses a serial port for console. I configured it so that during bootup all phases can be followed using that serial port. I.e. BIOS, boot loader, kernel and login are configured. The login TTY is configured as per the line below (in inittab):

T0:2345:respawn:/sbin/getty -L ttyS0 38400 vt100

Now, this may sound a bit exotic, but since the serial port is only used for maintenance in case of absent network connectivity, I would like to use that port again. In the particular scenario the port would be used to connect to another headless machine that is less reliable and is stored in the same remote location. This would allow to access the less reliable machine via serial connection remotely (e.g. over SSH).

So, how can I repurpose the ttyS0 (or generally any serial port) after successfully booting into the system? How can I "kill" the respective getty instances (note the respawn) without having to change inittab, which would defeat the whole purpose (because if the system does not come up with network connectivity next time, serial connectivity is essential for "repair").

link|improve this question

Consider not repurposing it. Sounds like you're using it as an emergency method of access if you can't access the system normally. So I would let init do its job of making sure the getty is always there, and if you need more serial ports for different purposes, get some cheap USB-to-serial adapters. That being said, if you insist on proceeding, know that you can run the getty command from a normal script instead of through init, and therefore control exactly when it does make login available via ttyS0. – ultrasawblade Mar 24 '11 at 1:54
@ultrasawblade: thanks, but USB-to-serial are not an option since the box in question does not have USB ports. The script is an idea, too. So you know of no way to kill a getty without having to change inittab? – STATUS_ACCESS_DENIED Mar 24 '11 at 15:32
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.