PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > ssh timeout script
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

ssh timeout script

Réponse
 
LinkBack Outils de la discussion
Vieux 06/05/2008, 16h59   #1
omie
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut ssh timeout script

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.

  Réponse avec citation
Vieux 06/05/2008, 17h43   #2
Joachim Gann
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ssh timeout script

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
  Réponse avec citation
Vieux 06/05/2008, 17h51   #3
Icarus Sparry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ssh timeout script

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".
  Réponse avec citation
Vieux 07/05/2008, 06h55   #4
omie
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: ssh timeout script

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.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h03.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10258 seconds with 12 queries