Wednesday, March 15, 2023

Tomcat

Tomcat is an Open Source, Java based, Web Application Server.
We can deploy only the WAR files.
In the Tomcat Server we are not able to deploy EAR Files.
In Jboss / Wildfly we can be able to deploy WAR & EAR files.


Application Servers
Tomcat ---------------------------------> Apache
Jboss / Wildfly   ----------------------->RedHat---------> IBM

Webspere Application Server ----------------------------> IBM
Weblogic  -------------------------------> BEA------------> Oracle


Directory Structure
  • bin   
    • startup.sh
    • startup.bat
    • .
    • shutdown.sh
    • shutdown.bat
    • .
    • catalina.sh
    • catalina.bat
    • .
    • Version.sh
    • Version.bat
  • conf
    • Servers.xml
    • Tomcat-Users.xml
  • lib
    • jar files

  • webapps
    • What ever we are goint to store web application.
    • That application are stored in here.

  • work
    • After deploying out application.
    • Application it may generate some files those files are stored in here.

  • logs
    • Catalina.out

  • temp




ln -s /opt/apache-tomcat-10.1.7/bin/startup.sh /usr/bin/startTomcat
ln -s /opt/apache-tomcat-10.1.7/bin/shutdown.sh /usr/bin/stopTomcat






Maven

Maven is an Open Source, Java based build tool.
With help of this we can create packages /  build artifacts.

Maven is not a executable Software.
Maven is a Archive file.

  • Java ------------> Ant , Maven & Gradle
  • .Net -------------> Nant & MS Build
  • Python --------->  PyBuild
  • Ruby -------------> Rake
  • JS, Node JS, Angular -----------> Grunt, gulp
Types of application using Java:
  1. Java Standalone applicatoin 
    • Jar (Java Archive)
    • Java code ( .classfiles )
  2. Java Web application
    • War (Web Archive)
    • Java code  + Web content ( html , css , js , xml , images)
  3. Java Enterprise  application
    • Ear  ( Enterprice  Archive )
    • Java code  + Web content ( html , css , js , xml , images)  more then web content called.
Default build scritpt file:
  • Ant     --------> build.xml
  • Maven --------> pom.xml  (Package Object Model)------->3.6.3 Version
  • Gradle  - ------> build.gradle
Deirectory Structure:
  • bin --------> binaries  --------> mvn
  • conf -------> Settings.xml
  • lib ---------> liberaries --------> Jar files 
  • boot ------->
Read more »

Labels:

Friday, March 3, 2023

Shell_Scripting

Class:01

What is Shell ?
         Shell is a programm,
         It will take the commands and it will gives to the OS to perform the Commands.

         Shell is an interface b/w User and OS.

Types of Shells:
  • sh
  • bash
  • ksh
  • zsh
  • csh
How to know which shell is installed in our OS?
        /etc/shells
        cat /etc/shells
        
        By default Sh & Bash shells are installed in our OS.
        sh
        Bash

Which Shell we are using on our OS?
        echo $SHELL
        ps -p $$
        echo $0

How to change the Shell type?
        /bin/csh
        /bin/ksh
        /bin/sh
        /bin/bash

What is the default Shell Type in latest OS?
        bash

Bash Shell Scripting:
        A Shell is a file containing a series of commands.
        The Shell reads the file and carries out the commands as through  they have been entered directly                    on the command line.
        Normally the Shell Script has the file extension is (.sh).

Bash Shell Scripting--------Linux
PowerShell Scripting--------Windows   (DOS Commands).

Why we need to learn the Shell Scripting?
  • Automate the regular jobs.
  • Taking database backups.
  • Monotering Several Server resources like...
    • CPU Utilization 
    • Memory Utilization
  • Portable (It can be executed in any Unix-like OS without any modifications)
Server_Resource_Monitering.sh
Dbback.sh
Cleanup.sh
Deploy.sh

#!/bin/bash ---------->Shebang line
--
|
|
------->.Abslute path of  shell type

How to run the Shell Script?
  • ./hello.sh
  • . hello.sh
  • sh hello.sh
  • bash hello.sh
#!/bin/bash

echo "Welcome to the world.."
echo "Today date is:"
date

How to run the Shell Script in debug mode?
        sh  -x hello.sh              -------------------->-x ------>dubug mode

How to run the specfic debug in Shell Scripting?
set -x
echo "Welcome to the India.."
echo "Welcome to the USA.."
set +x

cat -n hello.sh
sh -x hello.sh

Class:02

Fine Naming Conventions:

Comments:
        Single Line Comment:  #
        Multi Line Comment:  <<Keyword


                                                                    Keyword
Variable:
        Variable is one storage location.
        where we can store the values.

Types of Variables
  1. System Defined Variables
    • How to see the System Defined variables?
      • env
      • printenv
      • printenv | cut -d "=" -f 1,2
        • SHELL
        • USER
        • PWD
        • HISTSIZE
      • echo $SHELL
      • echo ${SHELL}
  2. User Defined Variables

Class:03

Command Line Arguments:
      While executing the ShellScript, passing the values to the Shell Scripts is called Command line Arg.

echo $0 --------> Script file name

echo $1 --------> 1st arg value
echo $2 --------> 2nd arg value
echo $3 --------> 3rd arg value
echo $4 --------> 4th arg value
echo $5 --------> 5th arg value
echo $6 -------->
echo $7 -------->
echo $8 -------->
echo $9 -------->
echo ${10} ----->10th arg value

echo $* --------> Display all the arg Value --------> all arg into a one String
echo $@  -------> Display all the arg Value --------> each arg as a one string

echo $# --------> No.of Arguments.

echo $$ --------> Process ID.

echo $? --------> Previous command execution status.
                           0 = Sucellfull
                apart from 0 = failure

#!/bin/bash
echo "Commnad Line Argument demo..."
if [ $# -eq 2 ];
  then
    echo $0

    echo $1
    echo $2

    echo $$
    echo $?
    echo $#
  else
  echo "Please pass minume 2 Arguments."
  echo "Usage: sh $0 arg1 arg2 "
fi

String:

        String is a group of charactors  enclosed in a singe or double quotes. 
string_value="Hi Team My Name is ReddySekhar, I am working in IBM in Mumbai Location..."

Sub-String:

      Some poration of value in the  original String.

substring = 
echo ${string_value:20} ---> ReddySekhar, I am working in IBM in Mumbai Location...

echo ${string_value:20:11} ----------> ReddySekhar

echo ${string_value: -10} ------------> Location..
echo ${string_value: (-10)} ------------> Location..

Arithmetic Operations:

  • expr 2 + 3
  • expr 2 - 3
  • expr 2 * 3 -------------------expr 2 \ * 3
  • expr 10 / 2
  • expr 30 % 3
Write a ShellScript, accept the 2 numbers from the user, and perform the arthmetic Operations?

Class:04

Read Command:

echo "Please enter your name"
read UserName

echo "The User name is:"$UserName

What is an Array?
        
Inputs and Outputs Redirections Symbols:

>    ------>  Redirect Standard O/P
>>  ------>  Appending the Standard O/P
<    ------>  Redirect Standard I/P

How to store Std I/P & Std O/P?

sh filename.sh 1 2 >  filename.log ------------>it's redirect Std O/P only
sh filename.sh 1 2 >  filename.log 2>&1

File Descriptors:

Class:05

Class:06


Labels: