From: omie on
I need to figure out how long does it take for my ssh client to
terminate due to inactivity. I wanted to do a script that when the
ssh session is provoked it sends a date command to the screen and then
every 10 minutes of inactivity sends the output of the date command to
the screen and "you have been inactive for 10 minutes" and then sleeps
for 10 minutes again and date output and you have been inactive for 20
minutes and so on and so forth so the user know how long of inactivity
they have.

Can someone please help me I dont know how to echo date to the
terminal. I would appreciate the advice.

From: Icarus Sparry on
On Tue, 06 May 2008 08:59:16 -0700, omie wrote:

> I need to figure out how long does it take for my ssh client to
> terminate due to inactivity. I wanted to do a script that when the ssh
> session is provoked it sends a date command to the screen and then every
> 10 minutes of inactivity sends the output of the date command to the
> screen and "you have been inactive for 10 minutes" and then sleeps for
> 10 minutes again and date output and you have been inactive for 20
> minutes and so on and so forth so the user know how long of inactivity
> they have.
>
> Can someone please help me I dont know how to echo date to the terminal.
> I would appreciate the advice.

Are you sure it is your ssh client that terminates due to lack of
activity? Whilst this is not impossible, it is unusual to say the least.

It might be that your shell is configured to logout after a certain
inactive time. As an example, bash and ksh will do this if the TMOUT
variable is set.

Depending on which ssh client you have, you might see if it supports a
ServerAliveInterval option, which provokes some activity periodically.

The command to echo the date to the screen is "date".

To find out how long you have been idle, you typically first need to find
out which tty you are on. The 'tty' program should tell you this. Then
look at the last modification time on this file, or else parse the output
of programs like "w".
From: omie on
The problem came up when someone was uploading huge amount of data, a
process that takes two hours, the session would timeout and the user
would not know if the job was successfully completed. So there is
activity on the screen just no i/o activity. I know the command I
just need to know how to echo onto a tty terminal.