View Single Post

  #2 (permalink)  
Old 04-12-2006, 07:48 AM
rockdalinux's Avatar
rockdalinux rockdalinux is offline
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 581
Rep Power: 7
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
Default Re: Help with killing

Quote:
Originally Posted by sparky
HI guys me again my counterstrike script is coming on greatguns now over 600 hundread lines long now (599 of them are coments )
LOL 599 comments.

Quote:
all i need to do now is sort out options 7 and 8 . but i am having trouble with option 7 stopping and restart servers what i want to happen is if the user chooses to restart server he enters a port number then i need to get the pid number for that server and kill it.
Try netstat to grab pid according to your PORT-NUMBER:
Code:
netstat -p -vant  | grep PORT-NUMBER | awk '{ print $7}' | cut -d'/' -f1
netstat -p -vant  | grep 27025 | awk '{ print $7}' | cut -d'/' -f1
Quote:
to stop server i would kil both
Use killall command:
Code:
killall program-name
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote