You are on page 1of 12

Mkdir /app

Tar –xzvf apache-tomcat-8.0.18.tar

Tar –xzvf jdk-7u79-linux-x64.tar

Edit /etc/profile.d/java1.sh

Edit /etc/profile.d/java2.sh

Edit /etc/profile.d/java1.sh

#!/bin/bash

export JAVA_OPTS="

-Xms10g \

-Xmx10g \

-XX:NewRatio=1 \

-XX:SurvivorRatio=10 \

-XX:PermSize=512m \

-XX:MaxPermSize=512m"

Edit server.xml

[appuser@app1 ~]$ sudo cat /app/tomcat1/conf/server.xml


Edit vi /app/tomcat1/bin/catalina.sh

Edit startup.sh

JAVA_HOME=/app/jdk17080_1; export JAVA_HOME

PATH=$JAVA_HOME/bin:$PATH; export PATH


/etc/profile.d/java1.sh

Place bepza.war

[root@apps5 localhost]# cat bepza.xml

<Context

docBase="/data/live_Apps/bepza"

privileged="true"

reloadable="true"
crossContext="false">

</Context>

[appuser@app1 ~]$ Chmod +x /etc/init.d/tomcat1

[appuser@app1 ~]$ cat /etc/init.d/tomcat1

#!/bin/bash

# This is the init script for starting up the

# This is the init script for starting up the

# This is the init script for starting up the

# Jakarta Tomcat server

# chkconfig: 345 91 10

# description: Starts and stops the Tomcat daemon.

#Licensed to the Apache Software Foundation (ASF) under one or more

# contributor license agreements. See the NOTICE file distributed with

# this work for additional information regarding copyright ownership.

# The ASF licenses this file to You under the Apache License, Version 2.0

# (the "License"); you may not use this file except in compliance with

# the License. You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software

# distributed under the License is distributed on an "AS IS" BASIS,

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.


# See the License for the specific language governing permissions and

# limitations under the License.

# Jakarta Tomcat server

# description: Starts and stops the Tomcat daemon.

#Licensed to the Apache Software Foundation (ASF) under one or more

# contributor license agreements. See the NOTICE file distributed with

# this work for additional information regarding copyright ownership.

# The ASF licenses this file to You under the Apache License, Version 2.0

# (the "License"); you may not use this file except in compliance with

# the License. You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software

# distributed under the License is distributed on an "AS IS" BASIS,

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

# See the License for the specific language governing permissions and

# limitations under the License.

# Jakarta Tomcat server

# description: Starts and stops the Tomcat daemon.

#Licensed to the Apache Software Foundation (ASF) under one or more


# contributor license agreements. See the NOTICE file distributed with

# this work for additional information regarding copyright ownership.

# The ASF licenses this file to You under the Apache License, Version 2.0

# (the "License"); you may not use this file except in compliance with

# the License. You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software

# distributed under the License is distributed on an "AS IS" BASIS,

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

# See the License for the specific language governing permissions and

# limitations under the License.

#(1) Download and Install a Java SE Runtime Environment (JRE)

#(1.1) Download a Java SE Runtime Environment (JRE),

# release version 6 or later, from

# http://www.oracle.com/technetwork/java/javase/downloads/index.html

#(1.2) Install the JRE according to the instructions included with the

# release.

# You may also use a full Java Development Kit (JDK) rather than just

# a JRE.
#

#(2) Download and Install Apache Tomcat

#(2.1) Download a binary distribution of Tomcat from:

# http://tomcat.apache.org/

#(2.2) Unpack the binary distribution so that it resides in its own

# directory (conventionally named "apache-tomcat-[version]").

# For the purposes of the remainder of this document, the name

# "CATALINA_HOME" is used to refer to the full pathname of that

# directory.

#NOTE: As an alternative to downloading a binary distribution, you can

#create your own from the Tomcat source code, as described in

#"BUILDING.txt". You can either

# a) Do the full "release" build and find the created distribution in the

# "output/release" directory and then proceed with unpacking as above, or

# b) Do a simple build and use the "output/build" directory as

# "CATALINA_HOME". Be warned that there are some differences between the

# contents of the "output/build" directory and a full "release"


# distribution.

#Note: Do not use JAVA_OPTS to specify memory limits. You do not need much

#memory for a small process that is used to stop Tomcat. Those settings

#belong to CATALINA_OPTS.

# Source function library.

## tomcat8

##

##

#### BEGIN INIT INFO

## Provides: tomcat8

## Required-Start: $network $syslog

## Required-Stop: $network $syslog

## Default-Start:

## Default-Stop:

## Description: Tomcat 8

## Short-Description: start and stop tomcat

#### END INIT INFO

### Source function library.

##. /etc/rc.d/init.d/functions

##
## tomcat8

##

##

#### BEGIN INIT INFO

## Provides: tomcat8

## Required-Start: $network $syslog

## Required-Stop: $network $syslog

## Default-Start:

## Default-Stop:

## Description: Tomcat 8

## Short-Description: start and stop tomcat

#### END INIT INFO

### Source function library.

##. /etc/rc.d/init.d/functions

TOMCAT_HOME=/app/tomcat1

TOMCAT_USER=root

SHUTDOWN_WAIT=20

tomcat_pid() {

echo `ps aux | grep org.apache.catalina.startup.Bootstrap | grep -v grep | grep


$TOMCAT_HOME | awk '{ print $2 }'`

start() {

pid=$(tomcat_pid)
if [ -n "$pid" ]

then

echo "Tomcat is already running (pid: $pid)"

else

# Start tomcat

echo "Starting tomcat"

ulimit -n 100000

umask 007

/bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh

fi

return 0

stop() {

pid=$(tomcat_pid)

if [ -n "$pid" ]

then

echo "Stoping Tomcat"

/bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh

let kwait=$SHUTDOWN_WAIT

count=0;

until [ `ps -p $pid | grep -c $pid` = '0' ] || [ $count -gt $kwait ]


do

echo -n -e "\nwaiting for processes to exit";

sleep 1

let count=$count+1;

done

if [ $count -gt $kwait ]; then

echo -n -e "\nkilling processes which didn't stop after $SHUTDOWN_WAIT seco


nds"

kill -9 $pid

fi

else

echo "Tomcat is not running"

fi

return 0

case $1 in

start)

start

;;

stop)

stop

;;

restart)
stop

start

;;

status)

pid=$(tomcat_pid)

if [ -n "$pid" ]

then

echo "Tomcat is running with pid: $pid"

else

echo "Tomcat is not running"

fi

;;

esac

exit 0

[appuser@app1 ~]$

You might also like