July 2010

You might find the following three Linux / Unix shell scripts helpful.

  • Display processes based on either %CPU or Memory Usage.
  • Display which user is utilizing the CPU the most.
  • Display system’s memory information – total, used and free.

(more…)

{ 3 comments }

Unix Shell Script to Execute Oracle SQL Query

by Sasikala on July 30, 2010

Question: Can you provide me a shell script that will accept oracle credentials, sql query to be executed and displays the output?

Answer: The shell script given below prompts some basic information and displays the output of the SQL.

You can use the same concept and hard-code some of these values in the shell-script itself and even run this script in the background to generate the output of an oracle sql query automatically (or use the oracle shell script from cron job).

This script accepts following values from the user:

  • Oracle username
  • Oracle password
  • Oracle SQL Query to be executed.

Script validates the $ORACLE_HOME and $ORACLE_SID set in environment.
(more…)

{ 0 comments }

Log Effectively Using Custom Perl Logger Module

by Balakrishnan Mariyappan on July 29, 2010

For any custom written user services and processes, you should maintain a log file to view the status of the service, or to troubleshoot any issues with the services/processes.

Perl CPAN offers few modules which provides the automated object interface for handling logging for services.

In this article, let us write our own Perl logger module which internally uses Perl CPAN modules: Log::Agent, Log::Agent::Driver::File and Log::Rotate.

This custom perl logger module will perform the following operations.
(more…)

{ 1 comment }

Emacs Macro Tutorial: How to Record and Play

by SathiyaMoorthy on July 28, 2010

Using Emacs Macro feature you can record and play a sequence of actions inside the editor.

This article explains how to perform record and play inside Emacs editor with an example.

If you are a Vim editor fan, refer to our How to record and play inside Vim editor article.
(more…)

{ 1 comment }

Three Sysadmin Rules You Can’t (And Shouldn’t) Break

by Ramesh Natarajan on July 27, 2010

When I drafted this article, I really came-up with 7 sysadmin habits. But, out of those 7 habits, three really stood out for me.

While habits are good, sometimes rules might even be better, especially in the sysadmin world, when handling a production environment.

Rule #1: Backup Everything ( and validate the backup regularly )

Experienced sysadmin knows that production system will crash someday, no matter how proactive we are. The best way to be prepared for that situation is to have a valid backup.
(more…)

{ 40 comments }

In bash shell, when you use a dollar sign followed by a variable name, shell expands the variable with its value. This feature of shell is called parameter expansion.

But parameter expansion has numerous other forms which allow you to expand a parameter and modify the value or substitute other values in the expansion process. In this article, let us review how to use the parameter expansion concept for string manipulation operations.

This article is part of the on-going bash tutorial series. Refer to our earlier article on bash { } expansion.
(more…)

{ 9 comments }

Question: While downloading using wget, I get the following error “Connecting to <URL>.. failed: Connection refused.”. I’m behind a proxy server. How do I fix it?

Answer: Export the http_proxy variable with your proxy server name or ip address and then try downloading as explained below.
(more…)

{ 4 comments }

In this article, let us discuss about how to setup tftpboot, including installation of necessary packages, and tftpboot configurations.

TFTP boot service is primarily used to perform OS installation on a remote machine for which you don’t have the physical access. In order to perform the OS installation successfully, there should be a way to reboot the remote server — either using wakeonlan or someone manually rebooting it or some other ways.

In those scenarios, you can setup the tftpboot services accordingly and the OS installation can be done remotely (you need to have the autoyast configuration file to automate the OS installation steps).
(more…)

{ 2 comments }