Linux Tips and Tricks

Linux Tips and Tricks

Limit the CPU usage of a particular process

January17

Hi All,

Here is the new utility called cpulimit

What is it ?

cpulimit is a simple program which attempts to limit the cpu usage of a process (expressed in percentage, not in cpu time). This is useful to control batch jobs, when you don’t want them to eat too much cpu. It does not act on the nice value or other scheduling priority stuff, but on the real cpu usage. Also, it is able to adapt itself to the overall system load, dynamically and quickly.

how to get it ?

sudo apt-get install cpulimit
or

Download it from http://cpulimit.sourceforge.net/

How to use it ?

cpulimit -e <process-name/PID> -l 30

Example:

cpulimit -e 2223 -l 30
cpulimit -e firefox -l 50

Thanks & Bye
Kamaraj

posted under Uncategorized | No Comments »

Check website is up or not

January16

Hi All,

Now we are gonna check the particular website is up or not. For that we need the lynx command

lynx is a general purpose distributed information browser for the World Wide Web

if you don’t have command in your OS, then you can download and install it from the below URL

http://lynx.isc.org/

or if you use the ubuntu, then execute the below command

sudo apt-get install lynx

Once it is installed, you can try the below program.

$ cat website_test.sh
lynx -dump $1 &> /dev/null
if [ $? = 0 ]
then
echo “website is up”
else
echo “website is down. Trigger the email”
fi

Output :

$ ./website_test.sh http://google.com
website is up
$ ./website_test.sh http://google32323232.com
website is down. Trigger the email

posted under Uncategorized | No Comments »

Show Desktop icon for Ubuntu

January11

Here is the trick to create the show desktop icon for the ubuntu operating system.

Make sure you already having the utility called xte. (type xte in the console and check whether it is already exists or not), If not, then do

sudo apt-get install xautomation

The above command will automatically install the xte utility.

or download the debian package from the below website and install manually.

http://in.archive.ubuntu.com/ubuntu/pool/universe/x/xautomation/xautomation_1.03-1_i386.deb

now goto the desktop and right click –> choose “create launcher”

Type: Application
Name : Show Desktop
Command : xte “keydown Control_L” “keydown Alt_L” “key d” “keyup Control_L” “keyup Alt_L”
Comment : Show Desktop

press ok to create the launcher, and drag the launcher to your gnome panel. That’s all. you created the show desktop icon for your ubuntu.

Enjoy and let me know if you face any problems.

posted under Uncategorized | No Comments »

Recent Comments

    Categories