APLawrence - Information and Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds Get APLawrence.com by RSS











(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Home > News Posts > killing processes ––>Re: Users Process still active after logging out
Printer Friendly Version




News Group Posts

killing abandoned processes


This can be worse than annoying - some badly written processes start sucking resources when abandoned. I have seen that frequently in COBOL apps.

You'll see those in "ps" with a lot of accumulated CPU time and no tty - so at least they are easy to spot!

On some systems, we've set up cron jobs that hunt for those at regular intervals because too many will bring the system to its knees.



Message-ID: <3BA142F7.B214F069@att.net> 
From: Steve Fabac <smfabac@att.net>
Newsgroups: comp.unix.sco.misc
Subject: Re: Users Process still active after logging out
X-UserInfo1: TSU[@SJGXRWQBWLYMBCB^]\@PJ_^PBQLGPQRZQMIWIWTEPIB_NVUAH_[BL[\IRKIANGGJBFNJF_DOLSCENSY^U@FRFUEXR@KFXYDBPWBCDQJA@X_DCBHXR[C@\EOKCJLED_SZ@RMWYXYWE_P@\\GOIW^@SYFFSWHFIXMADO@^[ADPRPETLBJ]RDGENSKQQZN
Date: Fri, 14 Sep 2001 05:19:57 GMT

John DuBois wrote:
> 
> In article <9nqncg$2nd$1@uranium.btinternet.com>,
> Jim Simpson <jim@hcsltd.com> wrote:
> >connecting to a scounix server over tcpip network, user ends session by
> >closing the window before logging off. The user is not listed by Who but the
> >processes this user started are still active and the ttyp is still in use
> >therefore the number of users are increasing over time until the server is
> >shutdown
> 
> If the user isn't listed by 'who', it indicates that the system detected the
> terminated connection and logged the user out.  In this case, a hangup signal
> is sent to the user's processes.  However, poorly written applications are free
> to ignore that signal or even to arrange that no such signal is sent at logout
> time.  Without further information, all we can say is that the culprits most
> likely include both the user and the application that was running on the
> server.
> 
>         John
> --
> John DuBois  spcecdt@armory.com.  KC6QKZ/AE  http://www.armory.com./~spcecdt/















John,

I have the same problem with a COBOL application on one of my client's 
SCO 5.0.5 machines. Always the same user and always running the same
program.  I have not been able to get the programmer to track down
any code to "ignore hang-up."

I have just started writing the following script to run from cron
to kill the orphaned processes. It's still in testing (just logging now
looking for inappropriate processes listed in killidle.log) but when I
tried uncommenting the system( "kill " $2 ) command, it killed the
specified process. 

kill -9 " $2 to cache oany process that ignores the -15 signal.

> :
> # @(#) killidle 1.1 9/12/01 smf
> # Script to test for abandoned vedco processes and to kill them
> #
> ps -ef | awk ' BEGIN { 
>    while ( "who" | getline ) {
>            aray[ $2 ] = $1
> #          print $2, $1        # uncomment for debugging
>    }
>       system( "sleep 6" )
> }
>  $6 ~ /ttyp/ { 
>    if ( aray[ $6 ] > "" ) next
>    if ( $8  == "login" ) next
>    system( "date >> /usr/adm/killidle.log" )
>    close( "date >> /usr/adm/killidle.log" )
>    print $0 >> "/usr/adm/killidle.log"
>    close("/usr/adm/killidle.log")
> #  print $2, $6, $1          # uncomment for debugging
>   bob = system( "kill -15  " $2 )
> } '

-- 

                                      Steve Fabac
                                       S.M. Fabac & Associates
                                        816/765-1670
 

If this page was useful to you, please click to help others find it:  

Your +1's can help friends, contacts, and others on the web find the best stuff when they search.

Comments?




More Articles by



Click here to add your comments



Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar



LOD Communications, Inc.

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.


My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!


book graphic unix and linux troubleshooting guide


 I sell and support
 Kerio Mail server
pavatar.jpg

This post tagged:

       - Shell
       - Troubleshooting
       - Unix Kill




Unix/Linux Consultants

Skills Tests

Guest Post Here