A shell script for restarting Tomcat

Source: Internet
Author: User

A shell script for restarting Tomcat #! /Bin/sh # Author: gudaihui # Desc: restart tomcat # Time: tomcatpath = "/usr/local/tomcat-6.0.18/" tomcatname = "tomcat-6.0.18" tomcatsh = "tomcat6.sh" if [$ #-ne 1]; then ps-ef | grep java | grep $ {tomcatpath}; pid =$ (ps-ef | grep java | grep $ {tomcatpath} | awk '{print $2 }') else pid = $1 fi echo-e "Before start $ {tomcatpath}, shocould kill the same run, kill pid $ {pid} (yes/no )? \ C "read Confirm case $ Confirm in y | Y | yes | Yes) rm-rf $ {tomcatpath} work/Catalina/localhost/* kill-9 $ pid rm-f $ {tomcatpath }$ {tomcatname }. pid sleep 1/etc/init. d/$ {tomcatsh} start; tail-f $ {tomcatpath} logs/catalina. out; *) echo "Restart $ {tomcatpath} is Canneled"; esac

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: info-contact@alibabacloud.com 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.