Sunday, December 25, 2011

Alias - An addition tutorial on application the Linux alias command

linuxbyexample.org One way to check that your web site is running, is to ping the web server that your site resides on, and see if you get a reply. The command for this is ping, followed by the number of times you want to connect to your server, specifying the web site address you want to test. Here I am testing the Linux By Example web site. As you can see, the server is responding, meaning that the web site is up and running. If I wanted to check this status out several times during the day, it would soon become tedious having to re-type this command every time. I know there are different ways, which save you from having to re-type commands, ie like searching your bash history, but that's one of the things I like about Linux, there is usually more than one way to achieve the same goal. Personally, I find it easier to create an alias for a given command sequence, if it's something I am likely to use on a regular basis. To see what alias commands your system already has set-up, you can simply type alias at the terminal prompt, which will give you a list of the current commands, and what shortcuts they are assigned to. Here you can see the word grep has been remapped to use grep in conjunction with the colour switch, which saves you having to specify this option on each grep command, effectively giving you auto colour highlighting by default. To create a new alias command, we simply type alias, followed by the letter or phrase we want to use, equals, followed by the actual ...

Iphone 4 Car Charger Review

Saturday, December 10, 2011

Fast Linux carapace commands intro

A fast overview of the output of several common linux shell commands: whoami, pwd, uname, ls, df, free, whois, whereis, and locate). Technical details: created with xvidcap (in mpeg2 format), converted to dv with mencoder so it could be edited in Kino. The audio was recorded separately with "record", and the two merged in kino. Exported to a flash file (flv).

Olympus Exercise Bike Top Quality

Wednesday, November 30, 2011

Check If a Process Is Running and Execute a Program in Linux Using Shell Script

!±8± Check If a Process Is Running and Execute a Program in Linux Using Shell Script

I always run linux applications manually using the terminal during the development stage. This has helped me immensely as I could see all the messages that were printed on to the linux console. I also had the habit of forgetting to start the Java program once the linux machine reboots. Well how many of you have had that experience? Ohh yes, I forgot to mention that I will be using a compiled java program as an example executable file for this tutorial.

Though this is acceptable for a system that is under development, it is not suitable to run an executable program using a terminal in production environment. So I would go about setting up a cron job to check if the process is running and start it up if it is not, using a shell script. This tutorial will give you an understanding of how to check for a running processes and start the process if not running using a shell script in linux.

Please note that shell script is not the only way to check for a running process or to start a process.

The Shell Script:

So let's name the file testshellscript.sh

You can use any editor like vi to write shell script.

#!/bin/sh

This is the first line of the shell script. It tells the script which interpreter to refer to. Next let us check for the running process

PROCESSFILE='ExecutableFile.jar'

if ps ax | grep -v grep | grep $PROCESSFILE > /dev/null

I am assigning the jar file name to a variable named PROCESSFILE and then using the linux command ps to check if the process is running.

then

echo "$PROCESSFILE is running, everything is fine"

else

echo "$PROCESSFILE is not running"

#start the process

/usr/local/jdk/bin/java -jar /opt/$PROCESSFILE > /dev/null 2>&1 &

Fi

If there is a running process, we need not do anything to it. So I am simply echoing a message saying that the Java program is running. And if the Java program is not running, I will attempt to start the Java program. The logic of the conditional statement is as follows:

if process running

then

do nothing

else

start the process / java program

end if

As the example executable file is a jar file I am using bin\java to execute the file. This is almost the same command used in a linux terminal. Only difference is the use of full paths. Also all the outputs are directed to the null device which is a special file that discards all data written to it.

Here is the complete code...

#!/bin/sh

PROCESSFILE='ExecutableFile.jar'

if ps ax | grep -v grep | grep $PROCESSFILE > /dev/null

then

echo "$PROESSFILE is running, everything is fine"

else

echo "$PROCESSFILE is not running"

#start the process

/usr/local/jdk/bin/java -jar /opt/$PROCESSFILE > /dev/null 2>&1 &

Fi


Check If a Process Is Running and Execute a Program in Linux Using Shell Script

Best Buy Nestle Locations

Thursday, November 24, 2011

Dislocations and Mechanical Properties of Crystals - An International Conference Held at Lake Placid September 6-8, 1956 Sponsored By Air Force Office of Scientific Research, Air Research and Development Command, and The General Electric Research Lab...

!±8±Dislocations and Mechanical Properties of Crystals - An International Conference Held at Lake Placid September 6-8, 1956 Sponsored By Air Force Office of Scientific Research, Air Research and Development Command, and The General Electric Research Lab...

Brand :
Rate :
Price :
Post Date : Nov 24, 2011 19:01:29
N/A



Brand New Coupons Pampers Swaddlers Promotions Herstyler

Friday, October 21, 2011

Linux - ambience up a DHCP Server (Video 1 of 4 for ambience up Linux Router/Gateway)

Order Remington Chainsaw Parts Yamaha U1 Piano Ideas Last Minute Coleman Power Inverter

Saturday, October 15, 2011

How to Animate in Adobe Flash

Stihl Ms 170 Chain Saw Best Quality

Tuesday, September 27, 2011

motorola x3 Driod sample video (the coolest dog)

Gasoline Safety Cans Purchase Cheap Playtex 4693

Monday, August 29, 2011

Dislocations and Mechanical Properties of Crystals - An International Conference Held at Lake Placid September 6-8, 1956 Sponsored By Air Force Office of Scientific Research, Air Research and Development Command, and The General Electric Research Lab...

!±8± Dislocations and Mechanical Properties of Crystals - An International Conference Held at Lake Placid September 6-8, 1956 Sponsored By Air Force Office of Scientific Research, Air Research and Development Command, and The General Electric Research Lab...

Brand : | Rate : | Price :
Post Date : Aug 30, 2011 06:05:06 | N/A

Prices Hair Exten

Thursday, August 25, 2011

Dislocations and Mechanical Properties of Crystals - An International Conference Held at Lake Placid September 6-8, 1956 Sponsored By Air Force Office of Scientific Research, Air Research and Development Command, and The General Electric Research Lab...

!±8± Dislocations and Mechanical Properties of Crystals - An International Conference Held at Lake Placid September 6-8, 1956 Sponsored By Air Force Office of Scientific Research, Air Research and Development Command, and The General Electric Research Lab...

Brand : | Rate : | Price :
Post Date : Aug 25, 2011 18:05:10 | N/A

Coupon Troy Bilt Leaf Vacuum

Friday, August 12, 2011

Dislocations and Mechanical Properties of Crystals - An International Conference Held at Lake Placid September 6-8, 1956 Sponsored By Air Force Office of Scientific Research, Air Research and Development Command, and The General Electric Research Lab...

!±8±Dislocations and Mechanical Properties of Crystals - An International Conference Held at Lake Placid September 6-8, 1956 Sponsored By Air Force Office of Scientific Research, Air Research and Development Command, and The General Electric Research Lab...

Brand :
Rate :
Price :
Post Date : Aug 12, 2011 07:32:25
N/A



Stihl Electric Blower Quickly !8!# Used Elliptical Trainers Discount


Twitter Facebook Flickr RSS



Français Deutsch Italiano Português
Español 日本語 한국의 中国简体。







Sponsor Links