#!/bin/bash # chkconfig: 345 10 90 # description: tomcat #**************************************************** #descirption: start or stop the tomcat # userage tomcat [start| stop|greload| restart] #Author: james Lee #Date: 2016-06-03 # #**************************************************** tomcathome="/usr/local/tomcat8/bin" #********************************Begin Start the shell************************************ case "$1" in start) echo -n " tomcat start:" cd $tomcathome ./startup.sh echo " Finished!!!!!!!!!" ;; stop) cd $tomcathome ./shutdown.sh echo "Stop Finished.................." ;; reload|restart) cd $tomcathome ./shutdown.sh sleep 10 ./startup.sh ;; *) echo "Usage: tomcat [start|stop|reload|restart]" exit 1 esac exit 0
複製文件到/etc/init.d/shell
chkconfig --add tomcattomcat