Showing posts from 2011

HMC vtmenu exit

You can exit the cosole of an LPAR ,that has been taken using HMC vtmenu ,by typing
"~." (press dot key after tild without qoutes )

If you had taken HMC vtmenu using SSH ,your ssh connection to HMC will alse loses.

Read /etc/passwd using TFTP venerability - How to resolve in AIX /etc/tftpaccess.ctl allow:/tftpboot
Save the file You are done..!!! Now the clients can only access /tftpboot using TFTP

FTP Banner in AIX /etc/ftpaccess.ctl
herald: /path/to/banner/file ---->Enter your welcome message in this file motd: on
2.refresh -s inted

You are done

DRBD on RHEL6 with YUM group

Building DRBD for 2.6.32-71.el6.x86_64 kernel
1.mkdir -p /root/rpmbuild/SOURCES/
3.cp drbd-8.3.10.tar.gz /root/rpmbuild/SOURCES/
4.tar -xvf drbd-8.3.10.tar.gz drbd-8.3.10
6../configure --with-km --with-distro=redhat --enable-spec
7.rpmbuild -bb drbd.spec
8.rpmbuild -bb drbd-km.spec /root/rpmbuild/RPMS/x86_64
10.mkdir /YUM/DiskReplicator
11.cp drbd-* /YUM/DiskReplicator/ /YUM/DiskReplicator/
13.createrepo . ---> The "." is important /etc/yum.repos.d/rhel6-1.repo

[DiskReplicator] name=rhel6-1 LoadBalancer repo baseurl= enabled=1 gpgcheck=0 /tmp/ -->To avoid rpm name clash
16.yum install yum-utils
17.yum-groups-manager -n "Disk Replicator" --id=drbd --description="DRBD, packages from ANSIL" --save=comps.xml --mandatory drbd.x86_64 --mandatory drbd-bash-completion.x86_64 --mandatory drbd-heartbeat.x86_64 --mandatory drbd-km-2.6.32_71.el6.x86_64.x86_64 --ma…

How to Configure YUM in RHEL6

Easy way to create your own repo
1. Put your RHEL6 media on DVD drive
2. Create a partition with size 6GB and mount it as /yum
3. Download the below script to /yum
4. Give execute permission to the downloaded script
5. Please open the file and try to understand it. If you found all safe ,then go to next step
6. Execute it...You will get an RHEL repo accessible through ftp

***Please feel free to comment your experience ***


Manual Steps (*Different approach from above script .The repo file not look like usual one)

YouTube Link :

1.create a directory to store packages .(Better you create a partition with 5GB size and mount it as /YUM)
mkdir /YUM
2.mount RHEL6 DVD
mount /dev/dvd /mnt
3.go to the mounted directory
cd /mnt/Packages/
4.copy all contents of DVD to /YUM (Note the "." in command )
cp . /YUM/
5.Install createrepo package with dependancie…

MySQL backup script

This script is made using dialogues
So without dialogue package it will not work

You can start a mysql instance in full customized way

The script is mainly focused on MySQL compiled from source code

The script is using a config file to get necessary information to store values like

path to mysql daemon ,myql dump,mysql safe ,user name and password to start mysql instance

You can download the script from the following link

The advantage is ,You can take the entire database as well as a particular table of a schema using this script.

Screen saver using script / CLI screen saver

Can you imagine we can make animations using shell script..?

Yes ...Here is one I made
A floating box in CLI with my name inside

You can execute the script in any row - column resolution
You can re-size the window if you are accessing system using PuTTy(little bit disturbance if you are resizing from large to small window but it will stabilize after few seconds)

The script is released under GNU public license

Download it from here

Try and post your comments

Terminal input output logger / Teminal recording

Logging terminal input and output

After a lot of googling I found a tool that can log all input and output of terminal in Unix system

The tool is rootsh and its not only used for logging but also used for root login for normal users using sudo.

So that the command entered by the user will be logged in a file as well as on syslog

We can make rootsh as a shell , So that all the activity by that particular user will be logged

The tool is released under GNU Open source license

You can download the tool from

I made a modified copy of mine on

The tool will log username,commands and its output in a file -- But no client IP
The command can be started as a shell -But it will take the default shell

I made some modification on this and it's working perfectly on my Linux machine
The link here

The extra modules I ad…

Shell Scripting - part 3

Fun with Shell scripting

tput cup command
This command is used to set properties of terminal

tput cup 0 0
This command will set courser position to top left corner of terminal

tput cup 0 0
echo "Ansil"

Save and execute script
The output "Ansil" will be displayed on top left corner of the terminal

Lets make this example more interesting

tput cup 12 35
echo "Ansil"

Save the file and execute the script
The out put will display "Ansil" on almost center of the screen,
Surprisingly you will not get your terminal back until you press enter OR you have to kill/terminate the script(we will discuss this later)

The read command is used to read values from terminal(by default standard input)

here the read command read values till an occurrence of ENTER key ,but the value will not be stored


Shell Scripting - part 2

Command Line Arguments
Here we will discuss some more about command line arguments( values passed along with script like flags in commands)
and how they can be accessed in script

1)Name of the program
The name of the program is stored in variable '0'
So the value can be accessed as ${0}
e.g:- vi
echo ${0}
The output of the program will be like
2)All arguments passed along with script
All values passed to the script(command line arguments) will be stored in variable '@'
So the value can be accessed as ${@}
e.g:- vi
echo ${0}
If you execute the script with ou…

Shell Scripting - part 1

The echo command
The easiest command in shell script
used for display text

echo "Hello world"

Variables in script
variables are used for storing values
It may be pe-defined or the value will be assigned on the fly (On execution of script)

The variable manipulation in scripting

${VAR} for retrieving the value assigned to VAR


b)On the fly
VAR=`expr ${i} + 1`

In example (a) the variabe VAR is assigned a value of 10
The value of VAR will be 10 through out the execution life of script(unless that variable is not alterd by another assignment)

In example (b)the variable VAR assigned a value that depend on the value of 'i' (another variable)
We will split the example to understand two command

expr ${i} + 1

i) evaluat the expression ${i} + 1
ii) Assign the result to VAR

Using the echo command we ca…

Basic Shell Scripting-step by step