Category Archives: LINUX

Formatting a Hard Disk on Ubuntu Server


umount filesystem
mkfs -t ext3 filesystem
mount filesystem

umount xvdp1
mkfs -t ext3 /dev/xvdp1
mount /dev/xvdp1

Increasing number of threads per process

There is no direct limit on number of threads a process can have. Rather, this is calculated using following formula:

number of threads = total virtual memory / (stack size*1024*1024)

Thus, the number of threads per process can by increasing total virtual memory or by decreasing stack size. Decreasing stack size can lead to code failure due to stack overflow while max virtual memory is equal to the swap memory.

Check you machine:

Total Virtual Memory: ulimit -v (default isĀ unlimited, thus you need to increase swap memory to increase this)

Total Stack Size: ulimit -s (default is 8Mb)

Command to increase these values:

ulimit -s newvalue

ulimit -v newvalue

replace new value with the value you want to put as limit.

How to increase swap memory?

Tagged , , , , , , , , , , , , , , ,

Shell Script to find a process using grep and taking an accortion accordingly using if else
y=`ps -ef | grep | awk '{print $9}' |head -1`
if [ $y = $x ]
	mail -s "SUCCESS: Fetcher Hourly Check", -a ""<<< "Hie Team,

This is to inform you that is running smoothly. So just sit back and chill.. .

I would recheck after one hour.

Best Regards,
Unix Script
BETA Fetcher"

	mail -s "FAILURE: Fetcher Hourly Check", -a ""<<< "Hie Team,

This is to inform you that is not running on BETA URLBroker. Take appropriate action asap.

Please note, that I have been designed to update you guys every hour if I don't find a paster process running on my machine.

Best Regards,
Unix Script
BETA Fetcher"

Email via UNIX Command


mail -s “subject” -a “Reply-To” <<“Your Message”


Press enter to change line, ‘\n’
etc wont work


mail -s “URLBroker Process Failure”, -a “”<<< “Hie Team”

Tagged , , , , ,

Writing a Cron Job

Open Cron:

crontab -e

0 * * * * * filename <– command for hourly run update


Make sure file is executable

chmod 0755

.sh file does define which application to use to open this file.

#!/bin/bash <– add this line to top of your .sh code

Tagged , , , , ,