Sponsored Content
Operating Systems HP-UX [Solved] How to remove / kill defunct processess? Post 302411070 by jgt on Wednesday 7th of April 2010 01:26:44 PM
Old 04-07-2010
This issue seems to be caused by users closing Windows terminal emulation sessions without first signing off, (clicking on the X before exiting the session.)
On SCO systems, these "ghost" sessions tend to consume all the available CPU trying to re-connect.
I wrote the following script to deal with this issue, but it should be used with caution.
On SCO systems telnet sessions are named ttypnn, on HP-UX it appears they are named pts/nnn.

Code:
#!/bin/ksh
if [ $# -eq 0 ]
then
echo Usage is delete.ghosts  Y or N
exit 1
fi
ps -leaf |grep ttyp >/tmp/ps.list
who >/tmp/user.list
LIST=; export LIST
separator=" "
while read a tty c 
do
LIST=$LIST$separator$tty
separator=" |"
done </tmp/user.list
grep -v "?" </tmp/ps.list |grep -v root |\
grep -E -v "$LIST" >/tmp/ghost.list
while read a b user pid e f
do
if [ $1 = Y ]
then
echo for real $user $pid
echo kill -9 $pid
#kill -9 $pid
else
echo test run $user $pid
echo kill -9 $pid
fi
done </tmp/ghost.list
#

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

child processess

Hi, suppose i want to display the child processess that are running at the background.how do u do it. ps -ef shows both parent and child processess i need to see only the child processess. cheers. (3 Replies)
Discussion started by: uni_ajay_r
3 Replies

2. Solaris

how do I kill defunct processes?

mqm 17700 16815 0 0:00 <defunct> kill -9 does not work, even as root (10 Replies)
Discussion started by: csaunders
10 Replies

3. Shell Programming and Scripting

[solved] remove pattern with sed

Hi, i want to remove a certain pattern when i type pwd. pwd will look like this: ..../....../....../Pat_logs/..../....../...../...... the dotted lines are just random directory names, i want it to remove the "Pat_logs/...../....../....../" part so for example: ... (8 Replies)
Discussion started by: a27wang
8 Replies

4. UNIX for Dummies Questions & Answers

[Solved] remove all files of 2010

Hi, how to use "rm" to delete only files from year 2010 ? Thank you. (2 Replies)
Discussion started by: big123456
2 Replies

5. Programming

[solved] how to remove header and footer

it still display header and footer header SQL*Plus: Release 10.2.0.1.0 - Production on Mon Sep 24 13:41:51 2012 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production With the Partitioning, Real... (0 Replies)
Discussion started by: ment0smintz
0 Replies

6. Shell Programming and Scripting

[Solved] remove file extension

Hi, I have some files with some extension e.g. abc.xml.REMOVE,xyz.xml,efg.xml.REMOVE . I have to remove the .REMOVE extension. I can display it using the below script but cannot rename it. ls -l|sed 's/\.REMOVE//' How can I rename this? Thanks in advance (7 Replies)
Discussion started by: babom
7 Replies

7. UNIX for Dummies Questions & Answers

[Solved] Help to remove a line from a file

Hi, I just upgraded one my server to latest version RHEL, I have many users who will do SSH from another server. I wanted to update all of the users home directory and remove the security key. For example. /home/XYZ/.ssh/known_hosts and remove this hostsname. Please see below and advise.... (2 Replies)
Discussion started by: samnyc
2 Replies

8. Shell Programming and Scripting

[Solved] awk to remove lines

Hi, I have a file with contents. file1: <2013 tttaaa abc123 <2013 gggdddd <2013 sssssss <2013 eeeee I need to remove the lines which do not have the word "tttaaa" can some one help ? (7 Replies)
Discussion started by: giri_luck
7 Replies

9. Shell Programming and Scripting

[SOLVED] Want to remove output from a command

Hi, I'm on AIX 5.2. I wrote a script that makes a traceroute to a host. The script works fine but each time it using the traceroute command its generate the 2 output lines. this is the command in my script traceroute -n -m 5 -w 2 $Host | grep 172 | awk '{print $2}' | tail -1 traceroute... (2 Replies)
Discussion started by: ce9888
2 Replies

10. Shell Programming and Scripting

[Solved] How to remove multiple files?

Hi Gurus, I have below files in one directory. the file name has date and time portion which is exactly the file be created. I need keep only lasted created file which is abc_20140101_1550 and remove rest of the file. abc_20140101_1300 abc_20140101_1200 abc_20140101_1400 abc_20140101_1500... (2 Replies)
Discussion started by: ken6503
2 Replies
IRSEND(1)							   User Commands							 IRSEND(1)

NAME
irsend - basic LIRC program to send infra-red commands SYNOPSIS
irsend [options] DIRECTIVE REMOTE CODE [CODE...] DESCRIPTION
Asks the lircd daemon to send one or more CIR (Consumer Infra-Red) commands. This is intended for remote control of electronic devices such as TV boxes, HiFi sets, etc. DIRECTIVE can be: SEND_ONCE - send CODE [CODE ...] once SEND_START - start repeating CODE SEND_STOP - stop repeating CODE LIST - list configured remote items SET_TRANSMITTERS - set transmitters NUM [NUM ...] SIMULATE - simulate IR event REMOTE is the name of a remote, as described in the lircd configuration file. CODE is the name of a remote control key of REMOTE, as it appears in the lircd configuration file. NUM is the transmitter number of the hardware device. For the LIST DIRECTIVE, REMOTE and/or CODE can be empty: LIST "" "" - list all configured remote names LIST REMOTE "" - list all codes of REMOTE LIST REMOTE CODE - list only CODE of REMOTE The SIMULATE command only works if it has been explicitly enabled in lircd. -h --help display usage summary -v --version display version -d --device use given lircd socket [/var/run/lirc/lircd] -a --address=host[:port] connect to lircd at this address -# --count=n send command n times EXAMPLES
irsend LIST DenonTuner "" irsend SEND_ONCE DenonTuner PROG-SCAN irsend SEND_ONCE OnkyoAmpli VOL-UP VOL-UP VOL-UP VOL-UP irsend SEND_START OnkyoAmpli VOL-DOWN ; sleep 3 irsend SEND_STOP OnkyoAmpli VOL-DOWN irsend SET_TRANSMITTERS 1 irsend SET_TRANSMITTERS 1 3 4 irsend SIMULATE "0000000000000476 00 OK TECHNISAT_ST3004S" FILES
/etc/lirc/lircd.conf Default lircd configuration file. It should contain all the remotes, their infra-red codes and the corresponding timing and wave- form details. DIAGNOSTICS
If lircd is not running (or /var/run/lirc/lircd lacks write permissions) irsend aborts with the following diagnostics: "irsend: could not connect to socket" "irsend: Connection refused" (or "Permission denied"). SEE ALSO
The documentation for lirc is maintained as html pages. They are located under html/ in the documentation directory. lircd(8), mode2(1), smode2(1), xmode2(1), irrecord(1), irw(1), http://www.lirc.org. irsend 0.9.0-pre1 October 2010 IRSEND(1)
All times are GMT -4. The time now is 08:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy