home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!sdd.hp.com!network.ucsd.edu!munnari.oz.au!yoyo.aarnet.edu.au!news.adelaide.edu.au!andrewr
- From: andrewr@iagu.itd.adelaide.edu.au (Andrew Rutherford)
- Newsgroups: comp.unix.ultrix
- Subject: Re: Anyway to stop X-windows?
- Date: 12 Dec 1992 03:09:33 GMT
- Organization: The University of Adelaide
- Lines: 48
- Message-ID: <1gbl5dINN61n@huon.itd.adelaide.edu.au>
- References: <gel.723819055@zen.sys.uea.ac.uk>
- NNTP-Posting-Host: iagu.itd.adelaide.edu.au
- X-Newsreader: TIN [version 1.1 PL6]
-
- Gareth Lee (gel@sys.uea.ac.uk) wrote:
- [ ... various stuff deleted ... ]
-
- + a specific socket is being used for X communication, as opposed to any
- + other legitimate purpose.
- +
- + If anyone knows of a way then I'd been very keen to hear.
-
- Have a look at iagu.itd.adelaide.edu.au:/pub/src/netproc.c
- (via anonymous ftp, of course.) Needs to be setgid kmem, derived
- from the ofiles source code (then hacked majorly, supports
- environmental variables, seraching for non-root sockets listening,
- sockets to off your network, all sorts of fun stuff.) Flags are listed
- in the top few lines of source. Is resonably portable, will compile
- on Ultrix (wo flags), SunOS (with -lkvm), and probably a few others.
-
- Does not work with OSF/1 as the kernel tables have changed,
- but I'm working on getting it going under both OSF/1 and Solaris 2.0
-
- Anyway, You'd do something like this:
-
- kill -9 `netproc Ia | grep 6000 | cut -c11-15`
-
- "I" is internet sockets only (provides as much information
- as it can on any type of sockets encountered), and the "a" is to
- include process information on all lines - by default, it only
- prints process information for the first socket owned by each
- process.
-
- So it kills off all processes having anything to do with an
- Xserver on :0.0. Of course, you'd want to clean up that line before
- you put it in cron so that it doesn't kill off PID 6000, if it happens
- to be accessing the network for some reason :-)
-
- Few notes - the flags are a mess at the moment (eg, "u", for
- process owned by a user, requires no space to be after it, and it
- invalidates the earlier "r" flag for root owned processes, but "r"'s
- compliment "R" (only non-root processes) is still valid). Any
- suggestions for improvement welcome.
-
- Hope this helps,
- Andrew.
-
- /*
- * Andrew Rutherford andrewr@itd.adelaide.edu.au
- * +61 8 228 5669 Real Programmers always confuse Christmas and
- * Room 1060, Adelaide Uni Halloween because OCT 31 == DEC 25 !
- */
-