linux下tomcat作为daemon进程运行
ar: libservice.a: Malformed archive
make[]: *** [libservice.a] Error 1
The file bin/commons-daemon-native.tar.gz contains dirty (already compiled)
code. On some systems this causes "make" to return the following error:
ar: libservice.a: Malformed archive
The solution is to run "make clean" before running "make".
I believe that "make clean" should be run before creating the tgz file, so that
there are no compiled/generated files laying around.
#!/bin/sh
##############################################################################
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##############################################################################
#
# Small shell script to show how to start/stop Tomcat using jsvc
# If you want to have Tomcat running on port please modify the server.xml
# file:
#
# <!-- Define a non-SSL HTTP/1.1 Connector on port -->
# <Connector className="org.apache.catalina.connector.http.HttpConnector"
# port="" minProcessors="" maxProcessors=""
# enableLookups="true" redirectPort=""
# acceptCount="" debug="" connectionTimeout=""/>
#
# That is for Tomcat-5.0.x (Apache Tomcat/5.0)
#
# Adapt the following lines to your configuration
JAVA_HOME=/usr/local/sun-java6-jdk
CATALINA_HOME=/usr/local/apache-tomcat-
DAEMON_HOME=$CATALINA_HOME
TOMCAT_USER=tomcat6 # for multi instances adapt those lines.
TMP_DIR=/var/tmp
PID_FILE=/var/run/jsvc.pid
CATALINA_BASE=$CATALINA_HOME #CATALINA_OPTS="-Djava.library.path=/home/jfclere/jakarta-tomcat-connectors/jni/native/.libs"
CLASSPATH=/
$JAVA_HOME/lib/tools.jar:/
$CATALINA_HOME/bin/commons-daemon.jar:/
$CATALINA_HOME/bin/bootstrap.jar case "$1" in
start)
#
# Start Tomcat
#
echo "Starting tomcat6..."
$DAEMON_HOME/bin/jsvc /
-user $TOMCAT_USER /
-home $JAVA_HOME /
-Dcatalina.home=$CATALINA_HOME /
-Dcatalina.base=$CATALINA_BASE /
-Djava.io.tmpdir=$TMP_DIR /
-wait /
-pidfile $PID_FILE /
-outfile $CATALINA_HOME/logs/catalina.out /
-errfile $CATALINA_HOME/logs/catalina.err /
$CATALINA_OPTS /
-cp $CLASSPATH /
org.apache.catalina.startup.Bootstrap
#
# To get a verbose JVM
#-verbose /
# To get a debug of jsvc.
#-debug /
if test $? -eq
then
exit
else
echo "Failed to start tomcat6"
exit
fi
;; stop)
#
# Stop Tomcat
#
$DAEMON_HOME/bin/jsvc /
-stop /
-pidfile $PID_FILE /
org.apache.catalina.startup.Bootstrap
if test $? -eq
then
echo "tomcat6 stopped"
exit
else
echo "Failed to stop tomcat6"
exit
fi
;; restart)
#
# Restart Tomcat
#
if $ stop
then
$ start
else
echo "Failed to stop running server, so refusing to try to start."
fi
exit
;; *)
echo "Usage: tomcat6 start|stop|restart"
exit ;;
esac
在以上脚本里面指定了TOMCAT_USER,jsvc将先以特权身份启动tomcat,随后切换到指定的用户,这样可以使tomcat以非特权身份监听需要特权的端口。
update-rc.d tomcat6 defaults
配置完成以后,tomcat就可以随系统自启动,并且以非特权用户作为daemon运行了。
linux下tomcat作为daemon进程运行的更多相关文章
- Linux下tomcat作为守护进程运行(开机启动、以指定的用户运行、解决非root身份不能绑定1024以下端口的问题)的配置方法
如题. 参考资料: http://www.jdiy.org/read.jd?id=y0haaynq1w http://blog.csdn.net/shw2004/article/details/578 ...
- Linux下Tomcat端口、进程以及防火墙设置
Linux下Tomcat端口.进程以及防火墙设置 1,查看tomcat进程: #ps -aux | grep tomcat(或者ps -ef | grep tomcat都行) 可以看到现在运行着两个 ...
- 解决linux下tomcat停止进程任存在问题
解决linux下tomcat停止进程任存在问题 在Linux下(之所以强调linux下,是因为在windows下正常),执行tomcat ./shutdown.sh 后,虽然tomcat服务不能正常访 ...
- Linux 下Tomcat的启动、关闭、杀死进程
Linux下Tomcat的启动.关闭.杀死进程 打开终端 cd /java/tomcat #执行 bin/startup.sh #启动tomcat bin/shutdown.sh #停止tomcat ...
- linux 下 tomcat 运行报错 Broken pipe
linux 下 tomcat 运行报错 Broken pipe 感谢:http://hi.baidu.com/liupenglover/blog/item/4048c23ff19f1cd67d1e71 ...
- Linux下tomcat的shutdown命令可以关闭服务但是杀不死进程
Linux下tomcat的shutdown命令可以关闭服务但是杀不死进程 原因: 一般造成这种原因是因为项目中有非守护线程的存在: 解决方案: 一.从Tomcat上解决 方案1:(推荐的方案:因为一台 ...
- 阿里云OneinStack,Linux下tomcat命令
阿里云OneinStack,Linux下tomcat命令 Linux下如何查看tomcat是否启动在Linux系统下,重启Tomcat使用命令操作的首先,进入Tomcat下的bin目录cd /usr/ ...
- Linux下tomcat部署
进入Tomcat下的bin目录 cd /usr/local/tomcat/bin 如果你想直接干掉Tomcat,你可以使用kill命令,直接杀死Tomcat进程 kill -9 7010 然后继续查看 ...
- Linux下tomcat服务
一:Linux下tomcat服务的启动.关闭与错误跟踪,使用PuTTy远程连接到服务器以后,通常通过以下几种方式启动关闭tomcat服务:切换到tomcat主目录下的bin目录(cd usr/loca ...
随机推荐
- 设计模式--工厂方法模式(Factory method pattern)及应用
面向对象的好处: 通过封装,继承,多态把程序的耦合度降低. 用设计模式可以使程序更加灵活,容易修改,且易于复用. 1. 工厂方法模式 Define an interface for creating ...
- poj 3761 bubble sort (排列组合)
#include<cstdio> #include<cstring> #define ll long long #define mod 20100713 ; ll a[maxn ...
- POJ3660 Cow Contest floyd传递闭包
Description N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming con ...
- Wordpress解析系列之PHP编写hook钩子原理简单实例
Wordpress作为全球应用最广泛的个人博客建站工具,有很多的技术架构值得我们学习推敲.其中,最著名最经典的编码技术架构就是采用了hook的机制. hook翻译成中文是钩子的意思,单独看这个词我们难 ...
- solr6.5 的安装与配置
运行环境: JDK: 1.8.0_131 Tomcat: 9.0.0.M21 Solr: 6.5.1 注:1.建议打开两个连接linux的窗口,一个负责 solr压缩目录,另外一个负责 ...
- python--DenyHttp项目(1)--调用cmd控制台命令os.system()
os.system() 参数传递cmd命令,命令执行成功返回0,失败返回1 在网上查看使用ping命令,能否Ping通 大神们有 用正则的,有用Popen() os.system()直接用返回值,简单 ...
- Mongodb启动&关闭
mac 下mongo的启动和关闭以及启动问题解决 mongo的安装在这:http://www.cnblogs.com/leinov/p/6855784.html Mac os mongodb数据安装路 ...
- h5 录音
得益于前辈的分享,做了一个h5录音的demo.效果图如下: 点击开始录音会先弹出确认框: 首次确认允许后,再次录音不需要再确认,但如果用户点击禁止,则无法录音: 点击发送 将录音内容发送到对话框中.点 ...
- HDU 3625 Examining the Rooms:第一类stirling数
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3625 题意: 有n个房间,每个房间里放着一把钥匙,对应能开1到n号房间的门. 除了1号门,你可以踹开任 ...
- 专业辟谣----ThinkSNS不仅仅是微博程序!
[摘要]ThinkSNS(简称TS),一款全平台综合性社交系统,为国内外大中小企业和创业者提供社会化软件研发及技术解决方案,目前最新版本为ThinkSNS+. ThinkSNS这个词,第一眼应该想到的 ...