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.logfile=%CATALINA_BASE%/logs/wrapper.log
#设置控制台的名称
wrapper.console.title=tomcat
#服务名称
wrapper.name=tomcat
#服务的显示名称
wrapper.displayname=tomcat application server
#服务的描述信息
wrapper.description=tomcat for ams system
配置完成后,回到tomcat的bin目录下,试试用tomcat脚本启动服务器
[root@suhao03 etc]# cd ../bin
[root@suhao03 bin]# ./tomcat start
Starting tomcat...
Waiting for tomcat....
running: PID:8445
可以到logs目录进一步查看tomcat启动的情况
[root@suhao03 bin]# cd ../logs/
[root@suhao03 logs]# tail -f wrapper.log
停止tomcat可执行以下命令
[root@suhao03 bin]# ./tomcat stop
5.安装及卸载服务安装及卸载服务可以通过脚本的install及remove参数完成,想查看service wrapper提供的参数,可键入命令:
[root@suhao03 bin]# ./collector-verify -help
Usage: ./collector-verify [ console | start | stop | restart | condrestart | status | install | remove | dump ]
Commands:
console Launch in the current console.
start Start in the background as a daemon process.
stop Stop if running as a daemon or in another console.
restart Stop if running and then start.
condrestart Restart only if already running.
status Query the current status.
install Install to start automatically when system boots.
remove Uninstall.
dump Request a Java thread dump if running.
5.1安装服务
[root@suhao03 bin] ./collectory-verify install
可以到/etc/rc.d/init.d目录看到增加了以下的符号链接:
collector-verify -> /usr/local/ams-collector-verify/bin/./collector-verify
5.2卸载服务
[root@suhao03 bin] ./collectory-verify remove
6.配置对内存溢出进行监控
在某些情况下,当应用出现outofmemory时,我们希望它能立即重启,java service wrapper可以为我们实现这一点。
打开conf/wrapper.conf文件,对以下内容进行设置
wrapper.filter.trigger.1001=Exception in thread * java.lang.OutOfMemoryError
wrapper.filter.allow_wildcards.1001=TRUE
wrapper.filter.action.1001=RESTART
wrapper.filter.message.1001=The JVM has run out of memory.
原文地址:http://blog.chinaunix.net/uid-664509-id-3398193. html