|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 me I dont know how to echo date to the terminal. I would appreciate the advice. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 me I dont know how to echo date to the > terminal. I would appreciate the advice. > I doubt that your ssh client times out. It could be the shell child process (see TMOUT environment variable for interactive sessions) or the underlying network: your OS might close idle TCP connections after a timeout (AIX defaults to 2h idle tcp connection timouts) or a firewall between client and server hosts could do the same. you could do something like this: (note that the interval is increased by ten minutes each turn, that's because the data transmitted by the echo command will restart any network related timeout) ssh server let i=600 while true do sleep $i echo succesfully slept $i seconds let i=$i+600 done Joachim |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 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". |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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. |
|
![]() |
| Outils de la discussion | |
|
|