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 > kill disconnected process awk script ––>Re: Users Processstill active after logging out
Printer Friendly Version




News Group Posts

kill disconnected process awk script




Message-ID: <3BAD15D8.A251EE6A@att.net> 
From: Steve Fabac <smfabac@att.net>
Newsgroups: comp.unix.sco.misc
Subject: Re: Users Process still active after logging out
References: <9nqncg$2nd$1@uranium.btinternet.com>
<3ba17fa5$0$330$8eec23a@newsreader.tycho.net>
<3BA142F7.B214F069@att.net>
<GJnn8B.1o2@wjv.com>
<f3f18bc0.0109170206.5c85bfa2@posting.google.com>
<3BA61109.FEBA8083@att.net> X-UserInfo1: TSU[@IONFJU_RV@YOZKD]_HBWB]^PCPDLXUNNHXIJYWZUYICD^RAQBKZQTZTX\_I[^G_KGFNON[ZOE_AZNVO^\XGGNTCIRPIJH[@RQKBXLRZ@CD^HKANYVW@RLGEZEJN@\_WZJBNZYYKVIOR]T]MNMG_Z[YVWSCH_Q[GPC_A@CARQVXDSDA^M]@DRVUM@RBM Date: Sun, 23 Sep 2001 04:46:34 GMT Steve Fabac wrote: > > Robert Carnegie wrote: > > > > bill@wjv.com (Bill Vermillion) wrote in message news:<GJnn8B.1o2@wjv.com>... > > > In article <3BA142F7.B214F069@att.net>, Steve Fabac <smfabac@att.net> wrote: > > > > > > >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 Snip












> > "kill" by default is "kill -15" which we all agree is preferred.
> > As to why an error message, evidently something is wrong when it
> > gets to the awk line "bob = system( "kill -15 " $2 )" but I can't
> > read awk.  Is it possible that $2 is coming up empty sometimes?
> 
> This script is still running in debug mode and I am waiting for client's
> system to have another episode where the script will start logging the
> pid and user name to /usr/adm/killidle.log. When that happens, I will
> be able to answer your questions about usage messages.
> 
> When I first started the script and the print $2, $6, $1 below was
> listing the correct PID, terminal, and user name:
> 
> >       print $0 >> "/usr/adm/killidle.log"
> >       close("/usr/adm/killidle.log")
> > #     print $2, $6, $1          # uncomment for debugging
> > #     bob = system( "kill " $2 )
> 
> When I uncommented bob = etc. above, the script killed the listed
> processes.  Prior to that, the script was "kill -15 " $2 and it
> failed. No other changes were made except to drop the -15.
> 
> > "kill" and "kill -15" with no other parameters both get the message
> > "Bad argument count" on our OpenServer 5.0.6A.

Found the problem:  system ( "kill -15" $2 ) Fails because there
is no space after -15 and before the ". Thus the argument to kill is
-15PID ( -15207 for PID = 206 ) and that "ain't a valid signal." 

The correct construct is system ( "Kill -15 " $2 ) and it works.


> >
> > You don't have a stray quote mark in the rest of the awk script?
> > Those have fascinating consequences.  I don't think a separate
> > script, or function, or single-word alias for "kill -1", &c.,
> > is the way to go.  (But feel free.)
> 
> --
> 
>                                       Steve Fabac
>                                        S.M. Fabac & Associates
>                                         816/765-1670

-- 



                                      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?



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



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.

g_face.jpg

This post tagged:

       - AWK
       - SCO_OSR5
       - Unix Kill




Unix/Linux Consultants

Skills Tests

Guest Post Here