Brief introduction:
Description: Jsvc is primarily used on non-Windows operating systems to run a Java server bound to a privileged port on a non-root user, a service wrapper written specifically by C, and easily combined with a shell script to write a daemon script. Run as a standalone process exists.
Quick installation:
Yum-y Install gcc autoconfcd/xm-workspace/xm-webs/xmcloud/tomcat8081/bintar-zxvf commons-daemon-native.tar.gz & & CD Commons-daemon-1.0.15-native-src/unix/bash support/buildconf.sh./configure--with-java=/xm-workspace/ XM-WEBS/XMCLOUD/JDK && make# Bin directory The default comes with daemon.sh calls is Jsvc command mv-f jsvc/xm-workspace/xm-webs/xmcloud/ TOMCAT8081/BIN/CD. /.. /&& RM-RF COMMONS-DAEMON-1.0.15-NATIVE-SRC
Daemon Script:
#!/bin/sh # tomcat run/start/stop/restart/version tomcat # # chkconfig: 2345 85 15 # description: apache tomcat daemon script# run/start/stop/restart/version tomcat using jsvc. # source function library. /etc/init.d/functionsport=8081home=/xm-workspace/xm-webs/xmcloudtomcat_user=tomcatjava_home=${home}/jdk/ Jrecatalina_home=${home}/tomcat${port}catalina_pid=/var/run/tomcat${port}.pidjava_opts= "-server -Xms1024m -Xmx1024m -Xmn384m -XX:PermSize=64m -XX:MaxPermSize=128m -XX:+UseParallelOldGC -xx:+printgcdatestamps -xx:+printgcdetails -xloggc:${home}/tomcat${port}/logs/gc.log -xx:+ Heapdumponoutofmemoryerror -xx:heapdumppath=${home}/tomcat${port}/heapdump.bin "export  Java_home catalina_home catalina_pid tomcat_user java_optsstart () { ${catalina_home}/bin/daemon.sh start prog_ppid= ' (cat ${CATALINA_PID}|grep -o "[^ ]\+\ ( \+[^ ]\+\) *") 2>/dev/null ' echo -e "host: $ (hostname) pid: ${prog_ppid:-" None "} prog: ${catalina_home} status : start "}stop () { prog_ppid= ' (cat ${catalina_pid}|grep -o " [^ ] \+\ ( \+[^ ]\+\) * ") 2>/dev/null ' ${CATALINA_HOME}/bin/daemon.sh stop echo -e "host: $ (hostname) pid: ${prog_ppid:-" None "} prog: ${catalina_home} status: stop "}status () { prog_ppid= ' (cat ${CATALINA_PID}|grep -o "[^ ]\+\ ( \+[^ ]\+\) *") 2>/dev/null ' if [[ "X${prog_ppid}" == "X" ]];then echo -e "host: $ (hostname) pid: ${prog_ppid:-" None "} prog: ${catalina_home} status: stop " else echo -e "host: $ (hostname) pid: ${prog_ppid:-" None "} prog: ${catalina_home} Status: start " fi}version () { ${catalina_home}/bin/daemon.sh version}case "$" in start) start exit $? ;; stop) stop exit $? ;; restart) stopstartexit $?;; status) status exit $? ;; version) versionexit $?;; *) echo "usage: tomcat${port} {start|stop|restart| Status|version} " exit $? esacexit 1
Access test:
Description: Change the port value of connector to 80 before testing/xm-workspace/xm-webs/xmcloud/tomcat8081/conf/server.xml, try/etc/init.d/tomcat8081 Restart Restart Access test
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/88/80/wKioL1f6OrLzSk01AAKNoQ6nnvU452.png "title=" 9.png " alt= "Wkiol1f6orlzsk01aaknoq6nnvu452.png"/>
This article is from the "ζ Automated operation and maintenance development Road ζ" blog, please be sure to keep this source http://xmdevops.blog.51cto.com/11144840/1859938
development tool _JSVC. Using JSVC to enable Tomcat to run the listening 80 port on a normal user?