# Java Main>
# or guarantee that the WrapperManager>
#> # of the documentation for details.
# 使用WrapperStartStopApp,这样可以通过命令带start/stop来启动/停止程序。
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperStartStopApp
# Maximum Java Heap> # 设置tomcat的JVM堆的最大值
wrapper.java.maxmemory=512
# Application parameters. Add parameters as needed starting from 1
# 设置启动、停止和重启参数
wrapper.app.parameter.1=org.apache.catalina.startup.Bootstrap
wrapper.app.parameter.2=1
wrapper.app.parameter.3=start
wrapper.app.parameter.4=org.apache.catalina.startup.Bootstrap
wrapper.app.parameter.5=true
wrapper.app.parameter.6=1
wrapper.app.parameter.7=stop
wrapper.filter.trigger.1=java.lang.OutOfMemoryError
wrapper.filter.action.1=RESTART
#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Format of output for the console. (See docs for formats)
wrapper.console.format=PM
# Log Level for console output. (See docs for log levels)
wrapper.console.loglevel=INFO
# Log file to use for wrapper output logging.
# 设置log文件路径
wrapper.logfile=%CATALINA_BASE%/logs/wrapper.log
# Format of output for the log file. (See docs for formats)
wrapper.logfile.format=LPTM
# Log Level for log file output. (See docs for log levels)
wrapper.logfile.loglevel=INFO
# Maximum>
# the log is rolled.> # of 0, disables log rolling. May abbreviate with the 'k' (kb) or
# 'm' (mb) suffix. For example: 10m = 10 megabytes.
# 设置log文件最大值
wrapper.logfile.maxsize=5
# Maximum number of rolled log files which will be allowed before old
# files are deleted. The default value of 0 implies no limit.
#设置log文件最多个数
wrapper.logfile.maxfiles=10
# Log Level for sys/event log output. (See docs for log levels)
wrapper.syslog.loglevel=NONE
#********************************************************************
# Wrapper Windows Properties
#********************************************************************
#> # windows下tomcat控制台名称
wrapper.console.title=Tomcat6 Application Server
#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
# using this configuration file has been installed as a service.
# Please uninstall the service before modifying this section. The
# service can then be reinstalled.
# Name of the service
# 设置服务名称
wrapper.ntservice.name=tomcat6
# Display name of the service
wrapper.ntservice.displayname=@app.long.name@
# Description of the service
wrapper.ntservice.description=@app.description@
# Service dependencies. Add dependencies as needed starting from 1
wrapper.ntservice.dependency.1=
# Mode in which the service is installed. AUTO_START or DEMAND_START
# 设置允许Tomcat服务自动启动
wrapper.ntservice.starttype=AUTO_START
# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false 6、设置tomcat开机自动运行:
ln -s /opt/tomcat/bin/tomcat /etc/init.d/tomcat 7、测试,执行命令:service tomcat start|stop|restart|status
至此,使用Java Service Wrapper来设置Tomcat作为Linux的服务完成,从此过程看来,Java Service Wrapper对tomcat的控制程度比tomcat自带的JSVC深入多了。
目录结构:
/opt/tomcat/bin
| tomcat
| wrapper
/opt/tomcat/logs
| wrapper.log(程序运行时自动产生)
/opt/tomcat/conf
| wrapper.conf
/opt/tomcat/lib
| libwrapper.so
| wrapper.jar
| test.jar