Reg process of killing

Thread Tools Search this Thread
Operating Systems Solaris Reg process of killing
# 1  
Old 12-03-2007
Reg process of killing

Dear All,

I have one doubt - when u use netstat -na | grep 8080 to know the status of 8080 ports.when it is listed someone is accessing the 8080 ports
like this
*.8080 *.* 0 0 64000 0 LISTEN 65535 0 64260 0 ESTABLISHED

Please can anyone say how to kill the process of that particular ip who is accessing 8080 ports.

Appreciate if anyone helps me.

# 2  
Old 12-03-2007
netstat won't show you which processes have those connections open but lsof does.
The commandline you'll probably want is
for pid in `lsof -i:8080 | grep '(ESTABLISHED)' | awk '{ print $2 }'` ; do kill $pid

Test it first though - wouldn't want to accidentally send a SIGTERM to the listening daemon Smilie

lsof -i:8080 on it's own should be very informative too

[edit]Oh, you want to target a given IP... I missed that bit on the first run through.
For a particular IP, replace the '(ESTABLISHED)' bit with '->' (for example)
# 3  
Old 12-04-2007
can i get lsof manual entry and patch
# 4  
Old 12-04-2007
lsof isn't part of Solaris. You need to download it from freeware repositories or recompile it from the source.

Alternatively, you can use pfiles to figure out which process is using this port, eg:

pfiles `ptree | awk '{print $1}'` | egrep '^[0-9]|port:' | grep -v "AF_INET6"

# 5  
Old 12-04-2007
Originally Posted by jlliagre
Alternatively, you can use pfiles to figure out which process is using this port
pfiles can sometimes be a little hard on the system, I've seen it impact performance considerably. Might be better on later versions of solaris but it was pretty nasty on 8.
# 6  
Old 12-05-2007
I believe pfiles is suspending the target process for a short period of time. Isn't lsof doing the same ?
# 7  
Old 12-05-2007
Originally Posted by jlliagre
I believe pfiles is suspending the target process for a short period of time. Isn't lsof doing the same ?
If you get the solaris optimized version of it, it seems to be ok - purely anecdotal evidence from my using it of course so take with a grain of salt. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Killing the process ID's

Hi , I have a list of application process id's. Is there a way to kill all the process listed below using the script, except the once which are starting with " Genesis " adm 1522 ABC_Process.tra adm 1939 Genesis_Process.tra adm 2729 Genesis_Archive.tra adm 3259 xyz_Process.tra (5 Replies)
Discussion started by: murali1687
5 Replies

2. Shell Programming and Scripting

**need help for killing a process through script**

Hello All, i hope you are fine. I need a little help from you people-- inside a script i want to kill a parent process by checking it with the child process.. p_pid=`ps -e | awk '/ra_cmd_d/ {print$1}'` here i am selecting the child process id in p_pid. next-- sleep_pid=`ps -af |... (3 Replies)
Discussion started by: onlyniladri
3 Replies

3. UNIX for Advanced & Expert Users

Killing A Stopped Process

UNIX Tutorial Five % kill %jobnumber Does that not work on a stopped process? I've tried to kill a stopped process and it is not working. Or do you need a certain type of shell for this to work? I don't see anything about this in my man pages. (3 Replies)
Discussion started by: cokedude
3 Replies

4. Shell Programming and Scripting

Finding the age of a unix process, killing old processes, killing zombie processes

I had issues with processes locking up. This script checks for processes and kills them if they are older than a certain time. Its uses some functions you'll need to define or remove, like slog() which I use for logging, and is_running() which checks if this script is already running so you can... (0 Replies)
Discussion started by: sukerman
0 Replies

5. Shell Programming and Scripting

script not killing process!

i am using script to connect remotly to server and run some commands , one of these commands is to kill some process but tried different ways with no hope sshpass -p 'pass' ssh -o StrictHostKeyChecking=no server kill -9 `pgrep procs` getting error message "kill: bad argument count" ... (2 Replies)
Discussion started by: mogabr
2 Replies

6. Shell Programming and Scripting

Killing process!!!!

Hi friends, i m in big trouble.... i have one script which connects two server below.. ------------------------------------- bash & eval x=$@ export x=`echo $x` #echo $x # ssh user@ bash /mbbv/location/ $x|sed '/Binary file/d'... (1 Reply)
Discussion started by: Shahul
1 Replies

7. UNIX for Dummies Questions & Answers

killing the process

Hi, First, I am running a scipt.While the script is running I realize that I dont want the script to be run so I am killing the script externally.Before the process gets terminated or killed it should delete all the temporary files created by the script.How to do this?Can anyone help me? ... (3 Replies)
Discussion started by: arthi
3 Replies

8. Shell Programming and Scripting

Killing of a process and send a mail if the process doesnot come up within 2 minutes

Hi Friends, I am new to this forum as well as new to shell scripting. I have a problem here and i need someone to solve this. Let us consider there are two processes(abc & def).There is a script which kills these two processes(i.e killtheprocess abc). Here abc is the argument . There is a... (1 Reply)
Discussion started by: Prince89
1 Replies

9. UNIX for Dummies Questions & Answers

killing a process

I can kill running processes on my linux red hat system using ctrl-c but cannot do it from command line of another terminal using kill -2 pid. Although I can kill them from command line using kill -9 pid and other signals. I would like to do it using the kill -2 pid. Thanks for your suggestions (6 Replies)
Discussion started by: bbhayana
6 Replies

10. Shell Programming and Scripting

killing process using a script

can I do ps -ef | grep <process_name> and kill the process is it exists? and send a mail to me that the process was found and killed Thanks much... KS (4 Replies)
Discussion started by: skotapal
4 Replies
Login or Register to Ask a Question