Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Add start, stop, restart for Tomcat

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

#Install tomcat

wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-9/v9.0.0.M4/bin/apache-tomcat-9.0.0.M4.tar.gz? crazycache=1

tar zxvf apache-tomcat-9.0.0.M4.tar.gz

mv apache-tomcat-9.0.0.M4.tar.gz /usr/local/tomcat

cd /usr/local/tomcat/bin

sh startup.sh

#Set startup (add restart)

cd /etc/init.d

vi tomcat

#!/ bin/bash

#

# tomcat

#

# chkconfig:

# description: Start up the Tomcat servlet engine.

# Source function library.

. /etc/init.d/functions

RETVAL=$?

CATALINA_HOME="/usr/local/tomcat"

case "$1" in

start)

if [ -f $CATALINA_HOME/bin/startup.sh ];

then

echo $"Starting Tomcat"

/bin/su root $CATALINA_HOME/bin/startup.sh

fi

;;

stop)

if [ -f $CATALINA_HOME/bin/shutdown.sh ];

then

echo $"Stopping Tomcat"

/bin/su root $CATALINA_HOME/bin/shutdown.sh

fi

;;

restart)

if [ lsof -i:8080 ];

then

/bin/su root $CATALINA_HOME/bin/shutdown.sh

echo $"Stop Tomcat OK"

fi

echo $"Tomcat NOT Run"

/bin/su root $CATALINA_HOME/bin/startup.sh

echo $"Starting Tomcat OK"

;;

*)

echo $"Usage: $0 {start|stop|restart}"

exit 1

;;

esac

exit $RETVAL

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report