Tomcat Linux啓動服務

在/etc/init.d建立一個tomcat的文件。java

記得文件受權和註冊系統服務。tomcat


tomcat文件內容以下:
rest

#!/bin/sh
#chkconfig: 345 99 10
#description: Tomcat auto start-stop script.
# Source function library.
. /etc/rc.d/init.d/functions
# Get config.
. /etc/sysconfig/network
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
### CHANGE THE STARTUP PATH TO YOUR START SCRIPT ###
startup='/usr/local/tomcat7/bin/startup.sh > /dev/null 2> /dev/null &'
shutdown='killall java'
start(){
echo -n $"Starting Tomcat service: "
$startup
RETVAL=$?
echo
}
stop(){
action $"Stopping Tomcat service: " $shutdown
RETVAL=$?
echo
}
restart(){
stop
sleep 10
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esacip

相關文章
相關標籤/搜索