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 ...
随机推荐
- 阿里聚安全移动安全专家分享:APP渠道推广作弊攻防那些事儿
移动互联网高速发展,要保持APP持续并且高速增长所需的成本也越来越高.美团网CEO在今年的一次公开会议上讲到:"2017年对移动互联网公司来说是非常恐的.".主要表现在三个方面,手 ...
- Python基础学习 -- 列表与元组
本节学习目的: 掌握数据结构中的列表和元组 应用场景: 编程 = 算法 + 数据结构 数据结构: 通过某种方式(例如对元素进行编号)组织在一起的数据元素的集合,这些元素可以是数字或者字符,或者其他数据 ...
- 【Lab】提取result的bits和Y-PSNR数据并整理到Excel
[Lab]提取result的bits和Y-PSNR数据并整理到Excel 更新:使用openpyxl库直接将数据写入Excel中 注意:openpyxl是第三方库,如果没有安装.请命令行里键入pip ...
- 47. leetcode 437. Path Sum III
437. Path Sum III You are given a binary tree in which each node contains an integer value. Find the ...
- 3. leetcode 463 Island Perimeter
思路:设原始周长为4*节点数,每当出现一次相邻的情况,原始周长会减2.
- K个最近的点
前段时间在网上看到一些准备找工作的人会在LintCode上刷题,然后我今天上去看了一下,也打算开始做题,然后把每天做的题目和以后的优化记录下来. 2017年8月6日 21:17:27 第一题: 描述: ...
- vue指令v-if示例解析
v-if根据表达式的值的真假条件渲染元素. <div id="app"> <p v-if="isRender">this is a me ...
- css2--背景
## CSS2 背景##### background-color 设置背景颜色 ##### background-image 设置背景图片- ````background-image:url(&quo ...
- uiautomator +python 实现安卓自动化
很多人看到这个题目我相信他们可能会说,uiautomator不是java开发的吗?python怎么用呢,其实呢 ,一开始我也是这么想的,看了金阳光老师的视频,也是用java写的,我表示不服,我要科学上 ...
- Python模块----linecache
Python标准库提供了一个有趣的模块:linecache模块.该模块用来从文件中读取任何的行,并且将这些lines使用缓存进行优化,常见的情况是从个大文件中读取指定的行.不过由于此模块使用内存进行缓 ...