Tomcat startup script

Source: Internet
Author: User

#!/bin/bash# chkconfig: 35 55 25# description: source tomcat server#  processname: tomcatexport jre_home=/usr/local/jdkexport java_bin=/usr/local/jdk/binexport  path= $JRE _home/bin: $PATHexport  classpath=.: $JRE _home/lib/dt.jar: $JRE _home/lib/tools.jarexport  Jre_home java_bin path classpathstart () {netstat -tulnp | grep :8080  &> /dev/nullif [ $? -eq 0 ];thenecho -e tomcat8080 Port started:  " \033[31m                [prohibit start]  \033[0m "        else       su  -m www -c /usr/local/tomcat/bin/startup.sh &> /dev/null#su  command,  -m  Keep environment variable,-c  use WWW user startup service sleep 5                 netstat -tulnp | grep :8080 &> /dev/nullif [  $? -eq 0 ];thenecho -e  start tomcat:  "\033[32m                 [OK] \033[0m "         elseecho -e  start tomcat:  "\033[31m                 [failure] \033[0m "         fifi}stop () {        netstat -tulnp |  Grep :8005 &> /dev/null        if [ $?  -eq 0 ];then/usr/local/tomcat/bin/shutdown.sh &> /dev/nullsleep  10netstat -tulnp | grep :8080 &> /dev/nullif [ $? -eq  0 ];thenkill  ' Ps aux | grep java | grep -v grep | awk  ' {print $2} ' Sleep 5netstat -tulnp | grep :8080 &> /dev/nullif [ $?  -eq 0 ];thenecho -e  Close tomcat:  "\033[31m                 [failure] \033[0m "         else                 echo -e  Close tomcat:  "\033[32m                 [OK] \033[0m "fielseecho -e  off tomcat: " \033[32m                 [Determine] \033 [0m "        fielseecho -e tomcat8005 Port does not start: " \033[31m                 [Disable] \033[0m "Fi}status () {Ps aux  | grep java netstat -tlnp | grep java | grep --color  80}restart () {echo -e  Restart time longer:  "\033[32m             [please later ...]  \033[0m "Stopstart}case $1 instart)         start;; Stop)         stop;; Status)         status;; restart) restart;; *) echo -e  usage:/etc/init.d/tomcat  "\033[32m   {start|stop|restart|status} \ 033[0m " esac

This article is from the "Wsyht blog" blog, make sure to keep this source http://wsyht2015.blog.51cto.com/9014030/1791398

Tomcat startup script

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: 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.