Operating System - HP-UX
1838614 Members
3971 Online
110128 Solutions
New Discussion

sh sessions not getting cleared

 
Natesan_1
Frequent Advisor

sh sessions not getting cleared

Configuration:
================
HPUX 11.11

Problem:
========

customer has calling script when user oper login to system to monitor system status. (just check system performence and syslog etc thro menu)

When user exist the script and close the telnet session, then user oper initiated process are cleared.

if the user oper close the telnet session abruptly, then there is process -sh still running by the user oper.
Like below mentioned.

oper 6744 1 0 16:47:31 ? 10:31 -sh
oper 26199 16659 0 15:55:46 ? 0:00 -sh

it is not showing ? instead of tty device name, When user oper disconnect the session without properly exist.

Can any one assist how come over come above issue doing necssary changes..

I am attaching the script for ur reference ,
INVENT
3 REPLIES 3
Thayanidhi
Honored Contributor

Re: sh sessions not getting cleared

Hi Natesan,

Ask your customer to close the shell "properly" Else define shell timeout variable! I don't remember the variable name.

Regds

TT
Attitude (not aptitude) determines altitude.
Bill Hassell
Honored Contributor

Re: sh sessions not getting cleared

Your script must use the trap command. While the default is to terminate when the connection is trashed, this apparently is not working, so make sure that there is a specific action:

trap "exit" 1 2 3 15

Now if your script creates any temporary files, include this in the trap action statement:

trap "rm -f /var/tmp/mytempfile; exit" 1 2 3 15

In addition, you can always set a shell timeout by using:

export TMOUT=3600


Bill Hassell, sysadmin
Natesan_1
Frequent Advisor

Re: sh sessions not getting cleared

Hi Bill,

Thanks for your reply.

trap exit sounds terminates the scripts if the telnet session disconnected .

Once agian thanks for your prompt reply.
INVENT