Kill Multiple Processes or PID on FreeBSD
Sometime I have problem killing all apache processes or PID on a high load web server even though the service has been stopped. One of the quick way to kill all the services is using ps command.
shell> ps ax | grep http
795 ?? S 0:01.03 /usr/local/sbin/httpd -DSSL
4280 ?? S 0:00.59 /usr/local/sbin/httpd -DSSL
4796 ?? S 0:00.47 /usr/local/sbin/httpd -DSSL
6219 ?? S 0:01.36 /usr/local/sbin/httpd -DSSL
10459 ?? S 0:01.34 /usr/local/sbin/httpd -DSSL
16048 ?? S 0:00.64 /usr/local/sbin/httpd -DSSL
16050 ?? S 0:00.43 /usr/local/sbin/httpd -DSSL
16562 ?? S 0:00.39 /usr/local/sbin/httpd -DSSL
19888 ?? S 0:00.47 /usr/local/sbin/httpd -DSSL
22362 ?? S 0:00.10 /usr/local/sbin/httpd -DSSL
92166 ?? Ss 0:49.08 /usr/local/sbin/httpd -DSSL
24972 p8 S+ 0:00.00 grep http
Try to grep httpd processes which currently running on your server
shell> ps ax | grep http | awk '{print $1}'
795
4280
4796
6219
10459
16048
16050
16562
19888
22362
92166
24995
use awk command to grab the process IDs
shell> ps ax | grep http | awk '{print $1}' | xargs kill
using xrgs command to kill all the process ID we have gather earlier.
This is a handful command instead of killing the process ID one by one.
A clean kill.
Related posts:
- Force Email Delivery on Exim Hundred emails are queuing on your mail relay server, and...
- Linux/Unix Search and Replace Text from Multiple Files In Linux/Unix, for newbie to do search text from multiple...
- MySQL 5 Server Cannot Start on Apple Mac Leopard There were some problem during configuring MySQL5 Server on Leopard...
- How to Create User with useradd in FreeBSD You can invoke “adduser” command in FreeBSD in order to...
- How to Change User’s Shell Environment in FreeBSD In FreeBSD, user’s default shell environment is either sh or...
- Configure NTP Server on FreeBSD Configure a NTP time server on FreeBSD is fairly easy....
- Cacti Spine Source Installation Error on FreeBSD Just noticed FreeBSD’s port still using old version of spine,...
- How to Enable Suidperl in FreeBSD Enable Suidperl In FreeBSD Due to security issues, by default...
- PostgreSQL Database signal 6 Error On Apple Mac After I have done PostgreSQL upgrade through MacPort, the database...
- Fixed Cacti Spine 0.8.7g Problem on FreeBSD On latest release of Cacti Spine 0.8.7g, it has new...
June 30th, 2009 at 3:37 pm
I’m just a lazy bump who uses killall. ;P