Re: Automatic kill of ghost session

From: Brian K. White (brian@aljex.com)
Date: 04/08/03


From: brian@aljex.com (Brian K. White)
Date: 8 Apr 2003 07:02:57 -0700


"Stefano" <stefano@nextgen.it> wrote in message news:<b6u74a$8q3r1$1@ID-175458.news.dfncis.de>...
> Hi all,
>
> I'm a newbie of SCO unix system. I need to solve this problem. I've got a
> SCO Openserver Enterprise r5.0.6. I've got 35 pc in my company works on this
> server. Windows user often close session without logging out so sometimes I
> need to go and kill manually ghost shell because I've can't get more than 60
> simultaneous connections.
>
> Is there the possibility to kill automatically ghost session? today to clear
> system i need to reboot it every night but i think it's not a very good
> thing...
>
> Thanks in advance
>
> Stefano

The easiest answer to this is idleout. It's not a very very good
answer but it's quick & easy.

idleout can help in two ways:
1) if you configure idleout in general, then any session that is
inactive for XX minutes will be killed by idleout. So if you have a
little room to have a few wasted connections (you don't actually use
all 60 connections all the time) then a user that got knocked out can
just go back in, and XX minutes later his previous session will go
away freeing up that connection again. The smaller you make XX, the
fewer headless connections there will be on average, but it also means
that windows will close on users when they didn't want just because
their screen didn't happen to see any activity for XX minutes. 2 hours
is usually about as small a time as most users will tolerate.

2) you can also use idleout as a quick & easy way to clear a mass of
headless connections at once, instead of using ps -ef |grep <prog>
note the process numbers, kill etc...
Instead you can warn everyone that some of their windows may close if
they are inactive in the last 5 minutes, then as root run:
  idleout 5
  (wait a few seconds)
  idleout 0
which turns on idleout with a value of 5 minutes, then turns it back
off. This will zap all the headless processes at once. This is good
for accidents that create a mass of headless processes at once like
power-cycling the hub disconnecting a patch cable that carries a lot
of traffic, or a power fluctuation in the building etc...

"man idleout" to see how to set it up so it is active all the time.

Another easy thing that will help a lot is, if they are using FacetWin
to log in (I'm guessing because FacetWin is server side licenced we
have a lot of customers using FacetWin and we have the same problem
you describe.) Upgrade FacetWin (it's free) In the last few versions,
there are 3 new options you can set in the server config file that
will affect all clients. They allow you to disable the various ways to
close the client window. I recommend setting just one of them to
disable the X button. You should leave the others (the
file->menu->disconnect) because once in a great while the client does
not understand that the session really is done and you need a way to
kill it.
The options are:

#########################################################################
# When set to YES, These options force FWT emulators (Build 446 and
above)
# to install the corresponding options in the .fwt files each
# time they connect to this server.
# Note that when set to NO, the settings have no effect. Nothing
# is reset in the .fwt file. Also note that editing those options
# out of a running .fwt file has no effect, since the .fwt is only
# read once, and before these options are applied..
#
# The "noclosetilldisc" directive prevents the user from clicking
# the normal Windows exit option either from the "File" menu or by
# using the [X] in the upper-right corner of a terminal window.
#
# The "nouserdisconnect=YES" directive disables the "Disconnect"
# option from the "File" menu as well as the "Disconnect" icon on the
# FacetWin icon toolbar.
#
# Neither of these can prevent powering off the PC, or killing the
# FWT emulator from the Windows Task Manager.
#
# The "nullmenu" directive disables the File, Edit, View menu at the
# top of the FacetWin Terminal window. That, in addition to turning
# off the toolbar, prevents any further configuration. This is only
# used in extreme cases.
#
terminal_emulator_noclosetilldisc=YES
terminal_emulator_nouserdisconnect=NO
terminal_emulator_nullmenu=NO
#########################################################################

As you may have inferred from the comments, there are equivalent
options that you can set in each users .fwt files instead of on the
server. You may be able to do that already without upgrading the
server.

And as the comments also inform us, this is just a helper to avoid the
most common cause of unexpected disconnects which is the user
disconnecting out of turn. There is still the problem of physical loss
of connection due to pc's going off on power-save (that you can avoid
by disabling the feature in all the PC's) pc's being turned off by
users, hubs/switches locking up, PC's locking up or crashing, anything
else that interrupts a network or a PC.

Beyond these two easy "fixes" there are several idleout-like programs
that you can download and install. They all take a little different
attack on the problem of trying to reliably decide if a session is
truly inactive and kill it. Which one is best for you you will have to
evaluate based on how your users actually use your system. What's the
best logic for one site is disasterous for another.

look for nidleout and piddle as a starting point.
ftp://ftp.armory.com/pub/admin/nidleout
http://www.aplawrence.com/Unix/piddle.html

I rather liked the program "idled" on linux. I have never tried but it
might be possible to compile that on Open Server.