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 ...
随机推荐
- Spring MVC的实现原理
Spring提供了DispatcherServlet,这个类不仅负责实现请求转发,还负责启动一个WebApplicationContext容器. 按照Spring一贯的IoC哲学,所有的Control ...
- Objective-c 多线程操作 自定义NSOperation 模拟下载
写在前面 使用多线程下载图片,使用内存缓存和磁盘缓存. 这里只为理解NSOperation及其派生类 真要应用到APP中 请下载成熟的第三方库 效果 下载多张图片时可控制线程并发数 分析 自定义NSO ...
- C++引用形参,函数返回多个值
之前编代码有遇到过想让一个函数返回多个值的情况,low low的我不知道有什么办法,直接使用的全局变量将函数里的值传出去. 今天看书,<C++primer>第五版中文版第189页:使用引用 ...
- 自动生成proto Js语句
在与后端的WebSocket通信时,前端要带一个proto文件是一个累赘的事情.首先是明显的曝光了协议实体对象,再一个浏览器客户端很容易会缓存该文件,新的协议更新可能导致客户端不能使用,另外在cdn服 ...
- 封装自己的Ajax框架
Ajax技术就是利用javascript和xml实现异步交互的功能. 首先先来介绍一下Ajax相关知识点 一.Ajax对象的创建 1.创建Ajax对象的方式 a.第一种方式是针对IE浏览器 b.第二种 ...
- [COGS 2051] 王者之剑
Saber大法吼 2051. 王者之剑 ★★★☆ 输入文件:Excalibur.in 输出文件:Excalibur.out 简单对比时间限制:1 s 内存限制:256 MB [题目描述 ...
- [BZOJ 1500]维修数列 [Splay Tree从进阶到住院]
历尽艰辛终于A掉了这题QwQ 贴COGS评论区几句话=.= 策爷:"splay/块状链表的自虐题.".深刻理解到如果没有M倾向就不要去写这题了.. -Chenyao2333 记得b ...
- 11.2.0.4 RAC 手动打补丁
1. 下载补丁和最新OPatchGI PSU : p25869727_112040_Linux-x86-64.zipOPatch : p6880880_112000_Linux-x86-64.zip ...
- Neo4j图数据库
01. 图数据库 图数据库是专门存储和检索大量信息网络的存储引擎.它可以有效地将数据存储为节点和关系,并允许高性能检索和查询这些结构.属性可以添加到节点和关系.节点可以用零个或多个标签标注,关系总是定 ...
- 16. leetcode 404. Sum of Left Leaves
Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 ...