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.

Click Here to Read the Full Post →

KDE 4.5 released

It has been a long time since I have worked on the KDE or any other linux graphical desktop environment. The latest release of KDE version 4.5 brings some improvements to the environment’s stability, performance and functionality. It is reported that this release has more than 16,000 bug fixes and many of the feature requests made by users have been filled.

Read more here

Is Firefox Losing Foothold on Linux?

Firefox has been the default browser on Ubuntu for a long time. But now it looks like Firefox may not be included as the default browser on Ubuntu Netbook Edition 10.10. Ubuntu Netbook Edition has been optimized for smaller screens enabling it to work better on netbooks with the Intel Atom computer processor.

The change has not been finalized yet but Chrome seems like a good choice for netbooks since it has a minimal design which takes up less space than any of the other browsers. It is also very fast.

Adding Virtual Disks to a Linux Virtual Machine in VMWare

In the earlier post (click here to read the post) I talked about adding a virtual disk to a Windows virtual machine. This post is going to focus on adding a virtual disk to a Linux virtual machine.

The initial steps that you need to follow in adding a virtual disk to the Linux machine is the same as for the windows machine. What differs is how the new disk is mounted and used in each OS. So you need to follow all the steps in my previous post right up to the point where you boot the guest operating system.

From here things are a bit different. Below are the steps you will need to follow to get the new virtual disk up and running

  • Once the guest operating system has booted up, login as root or any user that has sudo privileges. Remember that in Linux the first SCSI drive is sda, the second sdb etc… Let’s assume that this was the second SCSI drive we added to the system, so the device will be  known (available for use) as /dev/sdb
  • Once that is sorted out, we need to use the fdisk utility to initialize the virtual disk as a partition. The command is fdisk /dev/sdb
  • Enter the command n to create a new partition and enter 1 for first cylinder to mention that we will be using the whole disk
  • Once this is done we need to write a new partition table to this newly created partition. For that enter w which writes the new table and exits fdisk.
  • Now that we have created the partition, we need to format it. I am going to use the ext3 file system for this new disk. Therefore the command to format the new partition is mkfs -t ext3 /dev/sdb1.
  • Now let’s mount the partition. I am going to name this partition usr2. So first of all I go to the root directory (cd /) and use the command mkdir usr2. mkdir will create a folder by the name of usr2 and we are going to mount the partition on to this directory.
  • To mount the partition we run the command mount -t ext3 /dev/sdb1 /software. If you need to verify that the partition has been mounted, run the command df –h.
  • Now this mount will work until the virtual OS is restarted and we will have to manually mount it again.  So to make sure that the partition mounts every time the machine reboots, we need to add an entry in /etc/fstab.
  • So open the fstab file using the vi editor and add a new line as follows,
  • So once the fstab has been written, the partition (drive) will be mounted and un-mounted whenever the machine is started or shutdown.