2013年8月2日星期五

Ubuntu is set from the start Tomcat

 

1. cd / etc / init.d

 

2. sudo vi tomcat6

 

add the following :

 
  
#!/bin/sh 

### BEGIN INIT INFO
# Provides: tomcat
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the tomcat web server
# Description: starts tomcat using start-stop-daemon
### END INIT INFO

#tomcat auto-start

export JAVA_HOME
="/usr/lib/jvm/jdk1.7.0_21"
export CATALINA_HOME
="/home/ubuntu/tomcat6"

case
$1 in
start)
sh
/home/ubuntu/tomcat6/bin/startup.sh
;;

stop
)
sh
/home/ubuntu/tomcat6/bin/shutdown.sh
;;

restart
)
sh
/home/ubuntu/tomcat6/bin/shutdown.sh
sh
/home/ubuntu/tomcat6/bin/startup.sh
;;
*
)
echo 'Usage:tomcat6 start|stop|restart'
;;
esac
exit 0
 
 

3. set as executable : sudo chmod + x tomcat6

 

4. added since the launch of the task : sudo update-rc.d tomcat6 defaults

没有评论:

发表评论