Posts

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...

Tomcat Application Vertical Cluster

Application Cluster Packages Needed 1. 1. jdk-1_5_0_19-linux-i586.bin (http://www.oracle.com/technetwork/java/javase/downloads/index-jdk5-jsp-142662.html) 2. 2.. apache-tomcat-5.5.27.tar.gz (http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.27/bin/apache-tomcat-5.5.27.tar.gz) 3. 3. httpd-2.2.3-11.el5_1.3 (RHEL DVD) 4. 4. httpd-devel-2.2.3-11.el5_1.3.i386.rpm (RHEL DVD) 5. 5.tomcat-connectors-1.2.28-src.tar.gz (http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/source/jk-1.2.28/tomcat-connectors-1.2.28-src.tar.gz) 1. Install JDK 1.Copy jdk file to /tmp 2.[root@localhost]# chmod 755 jdk-1_5_0_19-linux-i586.bin 3.[root@localhost]#./ jdk-1_5_0_19-linux-i586.bin Accept license agreement by typing “ yes ” A new directory will be created on /tmp directory with name jdk1.5.0_19 Copy the jdk1.5.0_19 directory to /usr/local 4. .[root@localhost]# cp -rv jdk1.5.0_19 /...