Sending a keep alive signal to remote terminal

  • Follow


I am running Fedora 12, and using the remote desktop client KDC.  The 
remote system I'm connecting to will disconnect a line that has been idle 
for more than an hour. This isn't too bad really, but can get annoying at 
times.  Is there a script I can set up so that it sends something like a 
keystroke or mouse click every 20 minutes or so just to keep the line 
alive?

-Chris



-- 
TARDIS Express (TardEx) When it absolutely, positively, had to be there 
yesterday.
0
Reply Chris 10/6/2010 12:35:40 PM

Chris Kelling wrote:

> times.  Is there a script I can set up so that it sends something like a 
> keystroke or mouse click every 20 minutes or so just to keep the line 
> alive?

ping -i (time in seconds) remote.host
0
Reply Harald 10/6/2010 1:25:32 PM


Harald Meyer wrote:
> Chris Kelling wrote:
> 
>> times.  Is there a script I can set up so that it sends something like a 
>> keystroke or mouse click every 20 minutes or so just to keep the line 
>> alive?
> 
> ping -i (time in seconds) remote.host

That wont work

The service at the other end is expecting a keystroke, not an IP packet.

No other solution suggests itself tho.


0
Reply The 10/6/2010 2:24:22 PM

On Wed, 06 Oct 2010 12:35:40 +0000, Chris Kelling wrote:

> The remote system I'm connecting to will disconnect a line that has been
> idle for more than an hour. This isn't too bad really, but can get
> annoying at times.  Is there a script I can set up so that it sends
> something like a keystroke or mouse click every 20 minutes or so just to
> keep the line alive?

I encountered this problem nearly twenty years ago. Unfortunately I can't
remember the exact solution, so this is from my very foggy memory. If the
session is idle, the listening application can be configured to send a
terminal status request. This causes a response from the terminal, thus
keeping the line alive. (BTW the implementation is terminal specific, and I
think some models of terminal had to be changed for one that supported a
status request). It may also be possible to reconfigure the terminal server
board to prevent the timeout, but don't ask me anything about this, because
I went down the status request/response route. Don't ask me anything about
the telemetry (such as request and response codes), or supported terminal 
types, because I definitely can't remember.

Mark.

-- 
Mark Hobley
Linux User: #370818  http://markhobley.yi.org/

0
Reply markhobley3 (126) 10/6/2010 4:16:51 PM

Chris Kelling <kellingc@cox.net> writes:

> I am running Fedora 12, and using the remote desktop client KDC.  The
> remote system I'm connecting to will disconnect a line that has been
> idle for more than an hour. This isn't too bad really, but can get
> annoying at times.  Is there a script I can set up so that it sends
> something like a keystroke or mouse click every 20 minutes or so just
> to keep the line alive?

It is possible in X11 to synthesize mouse and keyboard events, although
I understand that some (many?) applications ignore them.  See 'man
XSendEvent' if you have X11 API docs installed.

I've not tried using it myself l-)

-- 
http://www.greenend.org.uk/rjk/
0
Reply Richard 10/6/2010 4:55:22 PM

Mark Hobley wrote:
> On Wed, 06 Oct 2010 12:35:40 +0000, Chris Kelling wrote:
> 
>> The remote system I'm connecting to will disconnect a line that has been
>> idle for more than an hour. This isn't too bad really, but can get
>> annoying at times.  Is there a script I can set up so that it sends
>> something like a keystroke or mouse click every 20 minutes or so just to
>> keep the line alive?
> 
> I encountered this problem nearly twenty years ago. Unfortunately I can't
> remember the exact solution, so this is from my very foggy memory. If the
> session is idle, the listening application can be configured to send a
> terminal status request. This causes a response from the terminal, thus
> keeping the line alive. (BTW the implementation is terminal specific, and I
> think some models of terminal had to be changed for one that supported a
> status request). It may also be possible to reconfigure the terminal server
> board to prevent the timeout, but don't ask me anything about this, because
> I went down the status request/response route. Don't ask me anything about
> the telemetry (such as request and response codes), or supported terminal 
> types, because I definitely can't remember.
> 

The problem exists if you cant access the server side stuff.

On a normal telnet type session, the timeout is controlled by..umm. 
Login IIRC? Bash? i.e. you can set remote timeouts somewhere in the 
system or disable them.

If you have to do it at the terminal end, you have to hack the terminal 
code.

Probably sending a null byte would keep te session alive.

Heres an ssh information snippet

http://ocaoimh.ie/how-to-fix-ssh-timeout-problems/

If using bash, there is a TMOUT variable as well,

Also, there are some other issues if you are going through NAT routers. 
I know that a telnet via NAT closes on me simply because the stateful 
NAT tables time out after a while.




> Mark.
> 
0
Reply The 10/6/2010 5:01:29 PM

Chris Kelling <kellingc@cox.net> wrote in
news:i8hqer$ju0$1@news.eternal-september.org: 

> I am running Fedora 12, and using the remote desktop client KDC.  The 
> remote system I'm connecting to will disconnect a line that has been
> idle for more than an hour. This isn't too bad really, but can get
> annoying at times.  Is there a script I can set up so that it sends
> something like a keystroke or mouse click every 20 minutes or so just
> to keep the line alive?
> 

Check if the remote system has a "nologout" or "set autologout none" or a 
similar option. I have been on systems that supported this. 

On the other hand check with your remote-connection clents options. I use 
the commercial SecureCRT ssh-client and  it has a section under Terminal 
called AntiIdle. It can send a user defined string once every so many 
seconds. It also has something called "Send protocol No-Op" but not sure 
what that is. 

Putty has something similar....No sure about the KDC remote desktop client 
though....

-- 
Rahul
0
Reply Rahul 10/6/2010 5:53:13 PM

On Wed, 06 Oct 2010 15:24:22 +0100, The Natural Philosopher wrote:

> Harald Meyer wrote:
>> Chris Kelling wrote:
>> 
>>> times.  Is there a script I can set up so that it sends something like
>>> a keystroke or mouse click every 20 minutes or so just to keep the
>>> line alive?
>> 
>> ping -i (time in seconds) remote.host
> 
> That wont work
> 
> The service at the other end is expecting a keystroke, not an IP packet.
> 
> No other solution suggests itself tho.


I'm not looking for a solution to a problem like the kep alive on a Cisco 
router, but something that records keystrokes and plays them back, like a 
macro generator.  Then every so often, the macro gets fired off, it sends 
the keystroke or mouse click, and the server is happy.


-- 
TARDIS Express (TardEx) When it absolutely, positively, had to be there 
yesterday.
0
Reply Chris 10/6/2010 5:59:16 PM

Chris Kelling writes:
> I'm not looking for a solution to a problem like the kep alive on a
> Cisco router, but something that records keystrokes and plays them
> back, like a macro generator.  Then every so often, the macro gets
> fired off, it sends the keystroke or mouse click, and the server is
> happy.

man script 

and

man scriptreplay
-- 
John Hasler 
jhasler@newsguy.com
Dancing Horse Hill
Elmwood, WI USA
0
Reply John 10/6/2010 6:13:10 PM

In article <87aamrmfb9.fsf@araminta.anjou.terraraq.org.uk>,
Richard Kettlewell  <rjk@greenend.org.uk> wrote:
>Chris Kelling <kellingc@cox.net> writes:
>
>> I am running Fedora 12, and using the remote desktop client KDC.  The
>> remote system I'm connecting to will disconnect a line that has been
>> idle for more than an hour. This isn't too bad really, but can get
>> annoying at times.  Is there a script I can set up so that it sends
>> something like a keystroke or mouse click every 20 minutes or so just
>> to keep the line alive?
>
>It is possible in X11 to synthesize mouse and keyboard events, although
>I understand that some (many?) applications ignore them.  See 'man
>XSendEvent' if you have X11 API docs installed.

Indeed - you are the only one posting on this thread so far who
understands the problem.  Everyone else is assuming that the target
machine is Unix or Unix-like and can be (and is being) accessed with
some "normal" client, like telnet, ssh, Putty, whatever.

The fact is that the OP explicitly mentions using a (Unix/Linux clone
of) (Windows-y) Remote Desktop - namely, KDC.  This leads one to assume
that there may not be any way to "force keystrokes/mouse events" into
the process (as there would be on a "normal" client, like telnet, ssh,
Putty, whatever)

Now, you are on the right track by talking about "synthesizing" mouse
and keyboard events under X11 (since, presumably, the KDC program runs
under X11).  Now, if we were talking Windows here, I'd heartily
recommend the "WinBatch" program (www.winbatch.com), but we're not, so
we are in search of something like WinBatch for X.  There are such
beasts (I think googling for "Android" will get you something - at least
it did several years ago, now that word has sorta been co-opted by a
certain Evil Empire - not Microsoft) - but I'm not sure how well they
work (Yes, I have monkeyed with them off-and-on over the years, but
never really got to a point where a) they worked well enough to be worth
the trouble and/or b) My need for such a tool was great enough that it
was worth the trouble to work through the bugs/implementation details.

But, in any case, I think this is the direction in which the OP should
be looking...

-- 
One of the best lines I've heard lately:

    Obama could cure cancer tomorrow, and the Republicans would be
    complaining that he had ruined the pharmaceutical business.

(Heard on Stephanie Miller = but the sad thing is that there is an awful lot
of direct truth in it.  We've constructed an economy in which eliminating
cancer would be a horrible disaster.  There are many other such examples.)
0
Reply gazelle 10/6/2010 8:44:48 PM

On Oct 6, 12:35=A0pm, Chris Kelling <kelli...@cox.net> wrote:
> I am running Fedora 12, and using the remote desktop client KDC. =A0The
> remote system I'm connecting to will disconnect a line that has been idle
> for more than an hour. This isn't too bad really, but can get annoying at
> times. =A0Is there a script I can set up so that it sends something like =
a
> keystroke or mouse click every 20 minutes or so just to keep the line
> alive?
>
> -Chris
>
> --
> TARDIS Express (TardEx) When it absolutely, positively, had to be there
> yesterday.

Can you switch to something like screen or vnc?
0
Reply Joe 10/16/2010 6:59:08 PM

On Wed, 06 Oct 2010 16:16:51 +0000, Mark Hobley wrote:

Don't ask me anything about the telemetry (such
> as request and response codes), or supported terminal types, because I
> definitely can't remember.

You could try sending the ENQ character from your application. You may
get back ACK.

Mark.

-- 
Mark Hobley
Linux User: #370818  http://markhobley.yi.org/

0
Reply Mark 10/24/2010 3:14:21 PM

On 10/24/10 11:14, Mark Hobley wrote:
> On Wed, 06 Oct 2010 16:16:51 +0000, Mark Hobley wrote:
>
> Don't ask me anything about the telemetry (such
>> as request and response codes), or supported terminal types, because I
>> definitely can't remember.
>
> You could try sending the ENQ character from your application. You may
> get back ACK.
>
> Mark.
>

Sometimes I resort to something like this to keep a connection open

while :; do echo "\000\c"; sleep 30; done &

or depending on the shell

while :; do echo -e "\000\c"; sleep 30; done &

0
Reply Joe 10/29/2010 5:38:05 PM

12 Replies
959 Views

(page loaded in 0.01 seconds)

Similiar Articles:


















7/19/2012 6:23:07 PM


Reply: