其他
Java Service Wrapper这种上古神器用过没?
tree /f
显示目录结构如下:
wrapper-linux-x86.
│ jdoc.tar.gz //javadoc文件
│ README_de.txt //说明
│ README_en.txt //说明
│ README_es.txt //说明
│ README_ja.txt //说明
│
├─bin //执行文件目录
│ demoapp //示例程序
│ testwrapper //测试程序
│ ★wrapper //主程序(重要)
│
├─conf //配置文件目录
│ demoapp.conf //示例配置文件
│ ★wrapper.conf //主配置文件(重要,文件名可修改)
│
├─doc //说明文档目录
│ index.html //首页
│ revisions.txt //版本说明
│ wrapper-community-license-1.1.txt //许可协议
│
├─jdoc //javadoc文档目录
│ index.html //首页
│
├─lib //依赖类库目录
│ ★libwrapper.so //wrapper linux文件(.so:用户层的动态库)
│ ★wrapper.jar //wrapper主程序(重要)
│ wrapperdemo.jar //示例程序
│ wrappertest.jar //测试程序
│
├─logs //日志目录
│ wrapper.log //日志文件
│
└─src //源代码目录
├─bin //执行程序目录
│ ★sh.script.in //shell脚本源代码(重要)
└─conf //配置目录
wrapper.conf.in //原始配置
./demoapp start
接下来会显示很多提示,最终显示如下页面:
STATUS | wrapper | 2013/07/30 11:22:47 | --> Wrapper Started as Daemon
STATUS | wrapper | 2013/07/30 11:22:47 | Java Service Wrapper Community Edition 64-bit 3.5.20
STATUS | wrapper | 2013/07/30 11:22:47 | Copyright (C) 1999-2013 Tanuki Software, Ltd. All Rights Reserved.
STATUS | wrapper | 2013/07/30 11:22:47 | http://wrapper.tanukisoftware.com
STATUS | wrapper | 2013/07/30 11:22:47 |
STATUS | wrapper | 2013/07/30 11:22:47 | Launching a JVM...
INFO | jvm 1 | 2013/07/30 11:22:47 | WrapperManager: Initializing...
INFO | jvm 1 | 2013/07/30 11:22:47 | DemoApp: Initializing...
INFO | jvm 1 | 2013/07/30 11:22:47 | Demo: start()
INFO | jvm 1 | 2013/07/30 11:22:47 | Demo: Showing dialog...
INFO | jvm 1 | 2013/07/30 11:22:47 | Demo:
INFO | jvm 1 | 2013/07/30 11:22:47 | Demo: ERROR - Unable to display the GUI:
INFO | jvm 1 | 2013/07/30 11:22:47 | Demo: java.awt.HeadlessException:
INFO | jvm 1 | 2013/07/30 11:22:47 | No X11 DISPLAY variable was set, but this program performed an operation which requires it.
INFO | jvm 1 | 2013/07/30 11:22:47 | Demo:
INFO | jvm 1 | 2013/07/30 11:22:47 | Demo: This demo requires a display to show its GUI. Exiting...
INFO | jvm 1 | 2013/07/30 11:22:48 | Demo: stop(0)
STATUS | wrapper | 2013/07/30 11:22:49 | <-- Wrapper Stopped
./testwrapper
./demoapp
Usage: ./程序名 [ console {JavaAppArgs} | start {JavaAppArgs} | stop | restart {JavaAppArgs} | condrestart {JavaAppArgs} | 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.
JavaAppArgs: Zero or more arguments which will be passed to the Java application.
Commands:
console 启动并显示控制台信息
start 作为一个守护进程后台启动
stop 停止程序
restart 重启程序
condrestart 重启已经运行的程序,与前者区别是程序必须已经在运行
status 查看该程序状态
install 将程序安装为自启动服务,即随系统启动而启动
remove 卸载自启动服务
dump 报告运行时的Java thread dump(thread dump百度百科:http://baike.baidu.com/view/5111187.htm)
Java Service Wrapper Community Edition 64-bit 3.5.20
Copyright (C) 1999-2013 Tanuki Software, Ltd. All Rights Reserved.
http://wrapper.tanukisoftware.com
Usage:
./wrapper <command> <configuration file> [configuration properties] [...]
./wrapper <configuration file> [configuration properties] [...]
(<command> implicitly '-c')
./wrapper <command>
(<configuration file> implicitly 'wrapper.conf')
./wrapper
(<command> implicitly '-c' and <configuration file> 'wrapper.conf')
where <command> can be one of:
-c --console run as a Console application
-v --version print the wrapper's version information.
-? --help print this help message
-- <args> mark the end of Wrapper arguments. All arguments after the
'--' will be passed through unmodified to the java application.
<configuration file> is the wrapper.conf to use. Name must be absolute or relative
to the location of ./wrapper
[configuration properties] are configuration name-value pairs which override values
in wrapper.conf. For example:
wrapper.debug=true
Please note that any file references must be absolute or relative to the location
of the Wrapper executable.
./wrapper -c wrapper.properties