Posts

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

1.vi /etc/tftpaccess.ctl allow:/tftpboot Save the file You are done..!!! Now the clients can only access /tftpboot using TFTP

FTP Banner in AIX

1. vi /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/ 2.wget http://oss.linbit.com/drbd/8.3/drbd-8.3.10.tar.gz 3.cp drbd-8.3.10.tar.gz /root/rpmbuild/SOURCES/ 4.tar -xvf drbd-8.3.10.tar.gz 5.cd drbd-8.3.10 6../configure --with-km --with-distro=redhat --enable-spec 7.rpmbuild -bb drbd.spec 8.rpmbuild -bb drbd-km.spec 9.cd /root/rpmbuild/RPMS/x86_64 10.mkdir /YUM/DiskReplicator 11.cp drbd-* /YUM/DiskReplicator/ 12.cd /YUM/DiskReplicator/ 13.createrepo . ---> The "." is important 14.vi /etc/yum.repos.d/rhel6-1.repo [DiskReplicator] name=rhel6-1 LoadBalancer repo baseurl=ftp://192.168.8.2/DiskReplicator enabled=1 gpgcheck=0 15.cd /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-hear

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 https://sites.google.com/site/ansilh/rhel6_repo.sh 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 : http://www.youtube.com/watch?v=scBtTTwLze0   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 create

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. https://sites.google.com/site/ansilh/mysql-backup-script/mybackup.sh

Screen saver using script / CLI screen saver

Can you imagine we can make animations using shell script..? Yes ...Here is one I made screen.sh 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 https://sites.google.com/site/ansilh/screen.sh 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 http://sourceforge.net/projects/rootsh/ I made a modified copy of mine on https://sites.google.com/site/ansilh/rootsh 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 https://sites.google.com/site/ansilh/rootsh/rootsh-1.5.3-final.tar.gz The ex

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 e.g:- [root@localhost]#vi file6.sh tput cup 0 0 echo "Ansil" Save and execute script The output "Ansil" will be displayed on top left corner of the terminal e.g:- Lets make this example more interesting #!/bin/bash clear tput cup 12 35 echo "Ansil" read 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 wi

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 file1.sh --------------------------------------------------------------------- #!/bin/bash echo ${0} --------------------------------------------------------------------- The output of the program will be like . /file.sh 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 file2.sh --------------------------------------------------------------------- #!/bin/bash echo ${0} -------------------------------------------------

Shell Scripting - part 1

The echo command ------------------ The easiest command in shell script used for display text e.g:- 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=value ${VAR} for retrieving the value assigned to VAR a)Pre-defined e.g:- VAR=10 b)On the fly e.g:- 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 and VAR= i) evaluat the expression $

Basic Shell Scripting-step by step

Image
Basic Shell Scripting-step by step If you are not a beginner go to summery page What is a script? Group of commands in one file for a specific or a number of actions to achieve a result 1. Select your editor You must have a text editor to write shell programs Select an editor in which you are comfortable Most common editors are Vi and Emacs 2. Structure of a script a)First line “#!/path/to/shell” b) Comments Purpose of script, author, created date, modifications, bug fix notes etc c) Body of script Commands to be executed This line will decide which shell to be used for executing the commands in script If the line is not present, system will use default shell E.g.:- 1 ------------------------------------ #!/bin/bash echo “Hello world” E.g. Explained ------------------------------------ The above script will execute echo “Hello world” in bash shell 3. Execute a scrip