Thursday, June 4, 2009

Kill all process instances at one go

Sometimes you might need to urgently kill all the java processes. Use the following command to do so:

ps -ef | grep java | xargs kill -9 awk '{print $2}' > /dev/null 2>&1

Tuesday, May 26, 2009

Find Quickly

find directory-path -name "*" -mtime -file-age -print

Example. Suppose you want to find the files which are created in last 5 days in /tmp directory your command will be.

find /tmp/ -name "*" -mtime -5 -print

Thursday, April 30, 2009

Wednesday, April 22, 2009

Now its easy to deploy

You lead a busy life. You don’t have the time to waste logging in and logging out of your servers all day, running tasks, installing software, keeping machines in sync, and trying to make sure it all happens correctly.

Let Capistrano do the heavy lifting for you. It is designed with repeatability in mind, letting you easily and reliably automate tasks that used to require login after login and a small army of custom shell scripts.

And if you still find it difficult then you have the Webistrano interface for the same.

Monday, April 13, 2009

copy large number of small files over the network - the fastest method

find /source/path -print |cpio -o -Hnewc |ssh -C 192.168.32.31 "cd /path/to/destgnation/; cpio -idvum" &>/dev/null

Wednesday, April 8, 2009

Getting login password from Apache authentication using PHP

$headers = apache_request_headers();

$auth= $headers['Authorization'];

$autha = explode(' ',$auth);

$pair = base64_decode($autha[1]);

$authb = explode(':',$pair);

echo $login = $authb[0];

echo '\n';

echo $pass = $authb[1];

include this in php tags :)