Sponsored Content
Full Discussion: Inactive Session
Top Forums UNIX for Dummies Questions & Answers Inactive Session Post 302076277 by System Shock on Sunday 11th of June 2006 08:45:34 AM
Old 06-11-2006
I think this is either going the wrong way, or maybe I'm not understanding what's being said.

The "idle process" you are talking about is not telnet or the shell, but rather an instance of the application that's being run through said telnet session, right?

In other words:
User telnets to box, starts application.
User closes terminal without properly exiting application.
User's session terminates, but application process keeps on running.

And what you want to find out is how to differenciate those application processes that are still running that where not properly shut down when the user terminated his telnet session, so you can safely kill them. Right?

If that's the case, i.e., the application process doesn't die when the telnet session is killed, then loking at user idleness is not going to help, since there actually won't be a user session associated with said application process.

I'd say first that I agree with what grial said - the app should catch ithe session being terminated -, anyway, without knowing specifics - and you know the devil is in the details -, I'd think that a simple parse of ps -ef would do the trick. Rather than looking for idle sessions, you can match PID's with a simple script. Quick example:

user1 logs in, so it creates some processes. One of the is the user's shell. When that user starts some application, that application process should show the user's shell as the application process' parent ID. I would think a simple match of said IDs in a cron job would do the trick; something like:

Code:
process=$(ps -ef | grep <my_application_process> | awk '{print $2}') 
parent=$(ps -ef | grep <my_application_process> | awk '{print $3}') 
count=$(ps -ef | grep ${parent} | wc -l)  ## this should catch at least 2 processes: 
                                          ## the PPID of application and the PID of
                                          ## user's shell
if (( ${count} < 2 )); then  ## if it only catches one, it'd mean user is no longer logged in
kill -9 ${process}
fi

Now, the above example is very simplified. You'd probably need to play around with arrays and other stuff, but hopefully it gives you the idea.

And, like I said before, if I misunderstood what's being asked, then, nevermind Smilie
 

7 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

inactive pages

hi, plz tell me, how can get the inactive pages in HP UX. bye.... (1 Reply)
Discussion started by: venkat_t
1 Replies

2. Shell Programming and Scripting

sqlplus session being able to see unix variables session within a script

Hi there. How do I make the DB connection see the parameter variables passed to the unix script ? The code snippet below isn't working properly. sqlplus << EOF user1@db1/pass1 BEGIN PACKAGE1.perform_updates($1,$2,$3); END; EOF Thanks in advance, Abrahao. (2 Replies)
Discussion started by: 435 Gavea
2 Replies

3. Shell Programming and Scripting

Hiding Directories on a Session by Session basis

Hi, Apologies if anyone has read my recent post on the same subject in the Linux forum, just thought actually the solution might more likely come from scripting. Essentially, I am trying to restrict access to directories based on the user's name AND their location on a session-by-session... (3 Replies)
Discussion started by: en7smb
3 Replies

4. Solaris

I am not able to login in gnome session and java session in Sun solaris 9& 10

I am not able to login in gnome session and java session in Sun solaris 9& 10 respectively through xmanager as a nis user, I am able to login in common desktop , but gnome session its not allowing , when I have given login credentials, its coming back to login screen, what shoul I do to allow nis... (0 Replies)
Discussion started by: durgaprasadr13
0 Replies

5. HP-UX

ssh session getting hung (smilar to hpux telnet session is getting hung after about 15 minutes)

Our network administrators implemented some sort of check to kill idle sessions and now burden is on us to run some sort of keep alive. Client based keep alive doesn't do a very good job. I have same issue with ssh. Does solution 2 provided above apply for ssh sessions also? (1 Reply)
Discussion started by: yoda9691
1 Replies

6. Shell Programming and Scripting

Determining if session is a login session

Besides 'who am i' and 'tty' what commands could be used to determine if a session is interactive as compared to a web process or cron process. Any command should work with the common unix variants. (3 Replies)
Discussion started by: jgt
3 Replies

7. Solaris

Difference between the desktop session and console session

what is the difference between desktop session and console session in solaris as i am wondering we use option -text for the former and -nowin for the later (1 Reply)
Discussion started by: kishanreddy
1 Replies
Apache::Session::Serialize::Sybase(3pm) 		User Contributed Perl Documentation		   Apache::Session::Serialize::Sybase(3pm)

NAME
Apache::Session::Serialize::Sybase - Use Storable to zip up persistent data and unpack/pack to put into Sybase-compatible image field SYNOPSIS
use Apache::Session::Serialize::Sybase; $zipped = Apache::Session::Serialize::Sybase::serialize($ref); $ref = Apache::Session::Serialize::Sybase::unserialize($zipped); DESCRIPTION
This module fulfills the serialization interface of Apache::Session by taking the data from Apache::Session::Serialize::Storable and modifying it to work with Sybase IMAGE fields. Note that you do not need to quote these values before inserting into the database, and that if you are using DBI::Sybase, you cannot use the data in a placeholder. If you use Apache::Session::Sybase as your session class, this will all get taken care of. AUTHOR
Apache::Session::Serialize::Storable was written by Jeffrey William Baker <jwbaker@acm.org>; the Sybase-specific data manipulation was written by Mark Landry <mdlandry@lincoln.midcoast.com> for use in an earlier version of Apache::Session::DBI::Sybase and placed here by Chris Winters <chris@cwinters.com>. SEE ALSO
Apache::Session::Serialize::Storable, Apache::Session::Sybase perl v5.10.1 2010-10-18 Apache::Session::Serialize::Sybase(3pm)
All times are GMT -4. The time now is 07:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy