Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My network users connect to our Redhat Advanced Server 2.1 system via telnet to access a database application. My fear is that sooner or later, one of these users will give the three finger salute to windows while they have a file locked, freezing the db for other users.
I have tested this theory, and it seems valid. Redhat doesn't take much notice when a connected machine dies. This doesn't seem to be a good way to keep a well sorted database intact.
So, does anyone have a trick that applies a daemon that is capable of sniffing out either a dead pc, or a non-existent session, or a locked up pc, then terminating the telnet session? I can terminate these sessions when users actually call me and tell me they have a problem, but sooner or later, someone will not call, and things can get messed up.
Well, of there is a way to monitor if the session has been active. Then you could either configure telnetd to drop all inactive connections after 2-3 minutes. That's only if the database is only accessed for a short burst of time and them usually terminated. Or make a nifty shell script to see how long a user has been idle then drop him.
Unfortunately, the users leave their telnet app up all day, and access the database as needed. So monitoring if there has been any activity from the user (input at their console) will not work in our situation.
As far as dropping idle sessions, I haven't seen that linux even takes note if a user terminal is offline, locked up, or even turned off. The telnet app stays active, and any locked files stay locked.
At work we have an HPUX bot that has the same sort of setup. Like you we rely on users telling us about disconnections. We also take a look to see who is logged on to see if there are any users in twice.
Can you not write a procedure in your database app that will kill a users db lock if they have been idle for too long?
I imagine that could be done. I was just hoping that as configurable as Linux is, I should be able to sense/control this aspect of the server.
I looked at Telnet itself, and it seems like there are built in tools for this, if implemented. Like a keep-alive signal. I am not a programmer though, and have no idea how to make RedHat utilize this feature.
I'll keep looking and see what I can find out. I can't be the first person in the world who has found a need for this feature.
The telnet option for keep alive is actually setting a socket option for this. It's not specific to telnet, it is a feature of TCP. Look at the file <kernel src>/Documentation/networking/ip-sysctl.txt (I'm sure it's on the web somewhere.) Specifically, 'tcp_keepalive_time' and the ones directly after it. I'm not sure how far you can get it down. I believe the default won't close the connection for ~2 hours. Try testing it on another machine as this is a system wide setting, not just port 23.
Another thing to look at is the application they are running (I'm assuming it's not sh). If you can get it to send out data regularly, like refreshing the screen, or displaying time, then the server should notice lost connections much faster. You can tune that timing as well.
Is the db locking per user? Perhaps you can kill the old telnet when they login again?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.