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.

Quick Screen Lock on Apple Mac OSX

mac-osx-leopard-available Locking your screen is critical when you are using your laptop in public or in the office, if you don’t lock your screen, within a second the data in your laptop might be owned by somebody who walk pass by your desk.

Does Apple Mac OSX support screen lock by keyboard shortcut key? I would say no, but you can do it with simple hacks.

Quick Screen Lock with Expose

One of my favorite screen lock method is through Expose. Before showing you how to lock the screen with Expose, you have to work on something at System Preferences.

Read the rest of this entry »

Star Wars ASCII Animation Through Telnet

Telnet to mail server port? telnet to web server port? telnet to domain name server port?

Why not telnet to watch Star Wars ASCII animation? Found this interesting stuff, An ASCII animation based on Star Wars created by Erik Thorne. Fire up your terminal and telnet the address as shown below. Before doing that, get a cup of coffee first ;)

Read the rest of this entry »

PCRE Error on PHP 5.2.x

Recent upgrade to PHP 5.2.8 and PHP 5.2.9 have given me some error on the PCRE/Regex library. That is some sort of bugs I search through the net, so far I still can’t find fixed or patch. After continuously compiling and recompiling of PHP on FreeBSD. I finally found a temporary workaround on the issue.

Read the rest of this entry »

MySQL Quick Installation on FreeBSD

Quick installation of MySQL Database on FreeBSD Server. Make sure you are on the latest FreeBSD Port Tree with portsnap, refer to keeping update ports. If you want to browse through what version of MySQL is available in FreeBSD;


shell> cd /usr/ports
shell> make search name=mysql | less
shell> Port:   mysql-server-5.1.34
Path:   /usr/ports/databases/mysql51-server
Info:   Multithreaded SQL database (server)
Maint:  ale@FreeBSD.org
B-deps: gettext-0.17_1 gmake-3.81_3 libiconv-1.11_1 libtool-1.5.26 mysql-client-5.1.34
R-deps: mysql-client-5.1.34
WWW:    http://www.mysql.com/

Port:   mysql-client-6.0.10
Path:   /usr/ports/databases/mysql60-client
Info:   Multithreaded SQL database (client)
Maint:  ale@FreeBSD.org
B-deps: gettext-0.17_1 gmake-3.81_3 libiconv-1.11_1 libtool-1.5.26
R-deps:
WWW:    http://www.mysql.com/

Port:   mysql-scripts-6.0.10
Path:   /usr/ports/databases/mysql60-scripts
Info:   Multithreaded SQL database (scripts)
Maint:  ale@FreeBSD.org
B-deps: gettext-0.17_1 gmake-3.81_3 libiconv-1.11_1 libtool-1.5.26 mysql-client-6.0.10 perl-5.8.9_2
R-deps: mysql-client-6.0.10 p5-DBD-mysql60-4.010 p5-DBI-1.60.7 p5-Storable-2.18 perl-5.8.9_2
WWW:    http://www.mysql.com/

Port:   mysql-server-6.0.10
Path:   /usr/ports/databases/mysql60-server
Info:   Multithreaded SQL database (server)
Maint:  ale@FreeBSD.org
B-deps: gettext-0.17_1 gmake-3.81_3 libiconv-1.11_1 libtool-1.5.26 mysql-client-6.0.10
R-deps: mysql-client-6.0.10
WWW:    http://www.mysql.com/

Read the rest of this entry »