Re: Terminate session on serial terminal (com0) when ssh disconnects

2014-08-14 Thread Christian Weisgerber
On 2014-08-12, Clint Pachl  wrote:

> Here's my situation: I ssh into a remote server in my group. From that 
> server, I connect to an adjacent, local server in the group via the 
> serial terminal using tip(1) or cu(1). If the ssh connection is 
> disconnected, the login session to the second server's serial com0 will 
> remain open/active.
>
> Is there a reliable, system-wide method or configuration to terminate 
> the serial session if the ssh connection dies?

It should just work... but it doesn't.

When the ssh connection is disconnected, tip/cu will receive a
SIGHUP and terminate.  This will close the outgoing cua(4) device,
de-asserting DTR, which with the usual null modem cable will de-assert
DCD at the incoming tty(4) device, which in turn should result in
a SIGHUP being sent to the processes on that tty.

I don't know offhand why this doesn't work.

-- 
Christian "naddy" Weisgerber  na...@mips.inka.de



Re: Terminate session on serial terminal (com0) when ssh disconnects

2014-08-14 Thread Martijn van Duren
On Tue, 2014-08-12 at 00:37 -0700, Clint Pachl wrote:
> Here's my situation: I ssh into a remote server in my group. From that 
> server, I connect to an adjacent, local server in the group via the 
> serial terminal using tip(1) or cu(1). If the ssh connection is 
> disconnected, the login session to the second server's serial com0 will 
> remain open/active.
> 
> Is there a reliable, system-wide method or configuration to terminate 
> the serial session if the ssh connection dies?

There already have been some answers, but you may also want to use
tmux(1) when working over ssh.
It will not close cu(1)/tip(1) connections when your ssh connection bugs
out, but you can re-login and just attach to the running session and
continue where you left of. I find that very convenient myself.
> 
> So far, all I have come up with is the shell's timeout variable (i.e., 
> TMOUT). However, this can be overridden by the user.
> 
> I also tried the gettytab(5) timeout option "to", but that didn't work 
> as expected. It terminates and restarts the initial terminal login 
> process, not the user session.
> 
> Thanks,
> Clint



Re: Terminate session on serial terminal (com0) when ssh disconnects

2014-08-14 Thread Stuart Henderson
On 2014-08-12, Clint Pachl  wrote:
> Here's my situation: I ssh into a remote server in my group. From that 
> server, I connect to an adjacent, local server in the group via the 
> serial terminal using tip(1) or cu(1). If the ssh connection is 
> disconnected, the login session to the second server's serial com0 will 
> remain open/active.
>
> Is there a reliable, system-wide method or configuration to terminate 
> the serial session if the ssh connection dies?
>
> So far, all I have come up with is the shell's timeout variable (i.e., 
> TMOUT). However, this can be overridden by the user.

Also TMOUT doesn't trigger if you're not in the shell.

> I also tried the gettytab(5) timeout option "to", but that didn't work 
> as expected. It terminates and restarts the initial terminal login 
> process, not the user session.
>
> Thanks,
> Clint
>
>

It's not exactly what you're asking for, but I would recommend looking at
conserver (in packages) and see if you can use it to get the desired
results. The conserver(8) daemon runs and connects to the port (optionally
logging to files) and allows (with per-user rw/ro authorisation) multiple
users to connect with the console(1) client, it also has idle timeout
options which can trigger a string or escape sequence (which can include
sequences to disconnect etc).



Re: Terminate session on serial terminal (com0) when ssh disconnects

2014-08-12 Thread Stefan Johnson
You can set TMOUT to read only so that it can't be changed by the user.

export TMOUT=90
readonly TMOUT


On Tue, Aug 12, 2014 at 2:37 AM, Clint Pachl  wrote:

> Here's my situation: I ssh into a remote server in my group. From that
> server, I connect to an adjacent, local server in the group via the serial
> terminal using tip(1) or cu(1). If the ssh connection is disconnected, the
> login session to the second server's serial com0 will remain open/active.
>
> Is there a reliable, system-wide method or configuration to terminate the
> serial session if the ssh connection dies?
>
> So far, all I have come up with is the shell's timeout variable (i.e.,
> TMOUT). However, this can be overridden by the user.
>
> I also tried the gettytab(5) timeout option "to", but that didn't work as
> expected. It terminates and restarts the initial terminal login process,
> not the user session.
>
> Thanks,
> Clint



Terminate session on serial terminal (com0) when ssh disconnects

2014-08-12 Thread Clint Pachl
Here's my situation: I ssh into a remote server in my group. From that 
server, I connect to an adjacent, local server in the group via the 
serial terminal using tip(1) or cu(1). If the ssh connection is 
disconnected, the login session to the second server's serial com0 will 
remain open/active.


Is there a reliable, system-wide method or configuration to terminate 
the serial session if the ssh connection dies?


So far, all I have come up with is the shell's timeout variable (i.e., 
TMOUT). However, this can be overridden by the user.


I also tried the gettytab(5) timeout option "to", but that didn't work 
as expected. It terminates and restarts the initial terminal login 
process, not the user session.


Thanks,
Clint