|
Prev: Usenet server test script
Next: Cygwin script issue
From: Joachim Gann on 6 May 2008 12:43 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. > 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
|
Pages: 1 Prev: Usenet server test script Next: Cygwin script issue |