Author: HH Time: 2017-09-24 location: Hangzhou Mail: chenhfxy@163.com
1. Prepare the custom jar package as follows:
The 1.1 exported jar packages are shown in the following illustration
2. Set the jar package as a Linux service, which is not implemented by hand-written shell script, instead of using the Third-party plug-in "Java service wrapper", download the address: https://wrapper.tanukisoftware.com /doc/english/download.jsp Note: 1 Java Service wrapper A total of three versions, respectively: Professional, Standard and community three, only the last version of the community can be used for free, Therefore select the version here should be Community version; 2 This operating system is CentOS 7 x86_64 system, so choose the download file as: linux-x86_64 commnity.
Download version model as shown in the following figure:
2.1 In the Root/supcon directory of CentOS 7, create a new Wrapper_home folder for later copying of some of the folders and files in the Java Service Wrapper.tar.gz unpacked directory;
Download the tar packets for the Java Service wrapper just downloaded through the SecureCRT tool under/root/supcon under the CentOS7 system, as follows: Press the shortcut key in the SecureCRT file: alt+p
Unzip the TAR pack
2.2 New folders in the Wrapper_home folder Bin, Conf, Lib, and logs
2.3 Copies of the following files: 1 copy wrapper-linux-x86-64-3.5.33/bin/wrapper to Wrapper_home/bin, then copy wrapper-linux-x86-64-3.5.33/src/ Bin/sh.script.in to Wrapper_home/bin.
2 copy wrapper-linux-x86-64-3.5.33/conf/wrapper.conf file to wrapper_home/conf
CP wrapper.conf/root/supcon/wrapper_home/conf 3) copy Wrapper-linux-x86-64-3.5.33/lib/wrapper.jar package to Wrapper_home/lib , and also copy our custom jar packages to the folder
2.4 Because the custom Tar pack runtime needs to read the relevant information from the configuration file Apcstorageconfig.xml, it is necessary to copy the profile to the Wrapper_home/bin directory because the executable file is running in the bin directory. You need to copy this profile to the same sibling directory:
command-line actions as shown in the previous illustration, the visual interface is shown in the following illustration:
2.5 starts to modify the wrapper_home/conf/wrapper.conf file "most important" 1) Java Runtime settings and program portals and associated dependent jar connection paths
2) Memory size setting and application parameter setting
3. Assign Wrapper_home/bin/sqlitedemo file to execute permissions chmod 775/root/supcon/wrapper_home/bin/ Sqlitedemo
4. Let custom services "Storageservice boot automatically" need to be created rc1.d in/etc/init.d, RC0.D, rc6.d ... wrapper_home/bin/ Sqlitedemo soft Connection, part of the command as shown in the following image:
5. Test Execution Command:
5.1 View Service service has started, if you need to turn off the service, you can use kill-9 6986 to implement
6. Test for successful access to cent in WIN10 system The Storageservice service in the OS7 system
you can see a service that has been successfully invoked to a customized Linux system "Note the firewall that needs to shut down Linux or set firewall release rules"
Reference: 1. http:// blog.csdn.net/lyflower/article/details/6098025 2. http://www.cnblogs.com/tangtianfly/archive/2012/03/19/2406264.html