Shell Restart Tomcat Script

Source: Internet
Author: User
Tags tomcat
#! /bin/bash
shutdown= $tomcat _home/bin/
starttomcat= $tomcat _home/bin/
echo "Off $tomcat_home"
ps-ef |grep Tomcat |grep $tomcat _home |grep-v ' grep ' |awk ' {print $} ' | Xargs kill-9

#删除日志文件, if you do not first delete the following line of
RM  $tomcat _home/logs/*-rf
RM  $ tomcat_home/work/*-rf

sleep 5
echo "Start $tomcat_home"
#tail-F $tomcat _ Home/logs/catalina.out

Note: First use Tomcat's own shutdown command to shut down, and then use the kill process to compensate, to really shut tomcat

Note 2:awk ' {print $} ' means taking the second segment of the previous query result
Write a picture description here

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.