Ubuntu做Tomcat服务:insserv: warning: script 'tomcat' missing LSB tags and overrides
https://blog.csdn.net/hanchao5272/article/details/79819460
转载自:https://blog.bbzhh.com/index.php/archives/134.html
就是使用 apt-get、apt-fast 安装软件就会报错,安装失败!
编写了一个tomcat开机自启动脚本,执行没问题,但是在安装mysql的时候出现了大量的:
insserv: warning: script 'S20tomcat' missing LSB tags and overrides
insserv: warning: script 'tomcat' missing LSB tags and overrides
insserv: There is a loop at service rmnologin if started
insserv: There is a loop between service rmnologin and mountnfs if started
insserv: loop involving service mountnfs at depth 6
insserv: loop involving service networking at depth 5
insserv: There is a loop between service tomcat and hwclock if started
insserv: loop involving service hwclock at depth 3
insserv: loop involving service mountdevsubfs at depth 2
insserv: There is a loop between service tomcat and udev if started
insserv: loop involving service udev at depth 1
insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true!
insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true!
insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true!
insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true!
insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true!
insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true!
insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true!
insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true!
insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true!
insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true!
insserv: Starting tomcat depends on rmnologin and therefore on system facility `$all' which can not be true!
居然还导致mysql安装后的自动配置提示失败,按照LSB tags规范改写脚本如下(debian8环境):
#!/bin/bash
### BEGIN INIT INFO
# Provides: bbzhh.com
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: tomcat service
# Description: tomcat service daemon
### END INIT INFO
#
# description: Apache Tomcat init script
# processname: tomcat
# chkconfig: 234 20 80
#
#
# Copyright (C) 2014 Miglen Evlogiev
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
#
# Initially forked from: gist.github.com/valotas/1000094
# Source: gist.github.com/miglen/5590986
#Location of JAVA_HOME (bin files)
export JAVA_HOME=/opt/jdk
#Add Java binary files to PATH
export PATH=$JAVA_HOME</span>/bin:<span class="variable">$PATH
#CATALINA_HOME is the location of the bin files of Tomcat
export CATALINA_HOME=/opt/tomcat
#CATALINA_BASE is the location of the configuration files of this instance of Tomcat
export CATALINA_BASE=/opt/tomcat
export CATALINA_BOOTSTRAP=/opt/tomcat/bin/bootstrap.jar
#TOMCAT_USER is the default user of tomcat
export TOMCAT_USER=tomcat
#TOMCAT_USAGE is the message if this script is called without any options
TOMCAT_USAGE="Usage: $0 {\e[00;32mstart\e[00m|\e[00;31mstop\e[00m|\e[00;31mkill\e[00m|\e[00;32mstatus\e[00m|\e[00;31mrestart\e[00m}"
#SHUTDOWN_WAIT is wait time in seconds for java proccess to stop
SHUTDOWN_WAIT=20
tomcat_pid() {
echo `ps -fe | grep $CATALINA_BOOTSTRAP | grep -v grep | tr -s " "|cut -d" " -f2`
}
start() {
pid=$(tomcat_pid)
if [ -n "$pid" ]
then
echo -e "\e[00;31mTomcat is already running (pid: $pid)\e[00m"
else
# Start tomcat
echo -e "\e[00;32mStarting tomcat\e[00m"
#ulimit -n 100000
#umask 007
#/bin/su -p -s /bin/sh $TOMCAT_USER
if [ `user_exists $TOMCAT_USER` = "1" ]
then
/bin/su $TOMCAT_USER</span> -c <span class="variable">$CATALINA_HOME/bin/startup.sh
else
echo -e "\e[00;31mTomcat user $TOMCAT_USER</span> does not exists. Starting with <span class="variable">$(id)\e[00m"
sh $CATALINA_HOME/bin/startup.sh
fi
status
fi
return 0
}
status(){
pid=$(tomcat_pid)
if [ -n "$pid" ]
then echo -e "\e[00;32mTomcat is running with pid: $pid\e[00m"
else
echo -e "\e[00;31mTomcat is not running\e[00m"
return 3
fi
}
terminate() {
echo -e "\e[00;31mTerminating Tomcat\e[00m"
kill -9 $(tomcat_pid)
}
stop() {
pid=$(tomcat_pid)
if [ -n "$pid" ]
then
echo -e "\e[00;31mStoping Tomcat\e[00m"
#/bin/su -p -s /bin/sh $TOMCAT_USER
sh $CATALINA_HOME/bin/shutdown.sh
let kwait=$SHUTDOWN_WAIT
count=0;
until [ `ps -p $pid | grep -c $pid` = '0' ] || [ $count</span> <span class="operator">-gt</span> <span class="variable">$kwait ]
do
echo -n -e "\n\e[00;31mwaiting for processes to exit\e[00m";
sleep 1
let count=$count+1;
done
if [ $count</span> <span class="operator">-gt</span> <span class="variable">$kwait ]; then
echo -n -e "\n\e[00;31mkilling processes didn't stop after $SHUTDOWN_WAIT seconds\e[00m"
terminate
fi
else
echo -e "\e[00;31mTomcat is not running\e[00m"
fi
return 0
}
user_exists(){
if id -u $1 >/dev/null 2>&1; then
echo "1"
else
echo "0"
fi
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
exit $?
;;
kill)
terminate
;;
*)
echo -e $TOMCAT_USAGE
;;
esac
exit 0
其实解决办法就是在#!/bin/bash下面添加:
### BEGIN INIT INFO
# Provides: bbzhh.com
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: tomcat service
# Description: tomcat service daemon
### END INIT INFO
当然,也可以一劳永逸的:
apt-get remove insserv
启动脚本文件就放在 /etc/init.d/ 文件夹下,文件名就叫报错的服务名。我报的是 tomcat8 ,是按别人教程安装的 tomcat ,看来就算是按着教程来,也不一定就没错误。
(PS:我还是建议不要走所谓的一劳永逸,还是改上面的文件比较稳妥。反正我是按上面的成功了,一劳永逸的方法不成功,反而出了另外的一些问题。)
Ubuntu做Tomcat服务:insserv: warning: script 'tomcat' missing LSB tags and overrides的更多相关文章
- insserv: warning: script 'lampp' missing LSB tags and overrides
https://ubuntuforums.org/showthread.php?t=2327011 1.方法一,编辑rc.loacl脚本 Ubuntu开机之后会执行/etc/rc.local文件中的脚 ...
- insserv: warning: script 'busybox-httpd' missing LSB tags and overrides
/********************************************************************************* * insserv: warnin ...
- 解决ubuntu的chkconfig[/sbin/insserv 无法找到路径问题]
http://www.cnblogs.com/lost-1987/archive/2012/10/17/2727285.html 今天在虚拟机里做DRBD实验,使用chkconfig管理服务的时候,出 ...
- Linux下tomcat服务
一:Linux下tomcat服务的启动.关闭与错误跟踪,使用PuTTy远程连接到服务器以后,通常通过以下几种方式启动关闭tomcat服务:切换到tomcat主目录下的bin目录(cd usr/loca ...
- linux下tomcat服务的启动、关闭与错误跟踪
linux下tomcat服务的启动.关闭与错误跟踪,远程连接到服务器以后,通常通过以下几种方式启动关闭tomcat服务: 1).启动tomcat服务 进入tomcat主目录下的bin目录,然后执行如下 ...
- linux下启动和关闭tomcat服务的方式
Linux下tomcat服务的启动.关闭与错误跟踪,通常通过以下几种方式启动关闭tomcat服务: 切换到tomcat主目录下的bin目录 启动tomcat服务 生产模式: 方式一:直接启动 ./st ...
- linux下启动tomcat服务
Linux下tomcat服务的启动.关闭与错误跟踪,使用PuTTy远程连接到服务器以后,通常通过以下几种方式启动关闭tomcat服务:切换到tomcat主目录下的bin目录(cd usr/local ...
- linux下启动tomcat服务的命令是什么
Linux下tomcat服务的启动.关闭与错误跟踪,使用PuTTy远程连接到服务器以后,通常通过以下几种方式启动关闭tomcat服务:切换到tomcat主目录下的bin目录(cd usr/local/ ...
- 配置 Tomcat 服务 和 自启动
如果我们使用war 包进行部署项目的时候,需要把包放进Tomcat的目录下,为了使我们的服务能够在服务器重启的时候自动启动起来,我们需要把Tomcat设置成自起服务. 配置 Tomcat 服务 新建服 ...
随机推荐
- Chapter 3 Phenomenon——5
I saw several things simultaneously. 我同时看见了几件事情. Nothing was moving in slow motion,the way it does i ...
- python mysql uitl
from traceback import format_exc import pymysql as MySQLdb class MySQLUtils(object): def get_db_conn ...
- 使用signtool.exe来验证程序的数字签名是否成功(命令行)
signtool.exe是微软提供的数字签名工具,使用如下 signtool verify /pa YourApplicationName
- Hadoop MapReduce流程及容错
shuffle流程 输入分片(input split):在进行map计算之前,mapreduce会根据输入文件计算输入分片(input split),每个输入分片(input split)针对一个ma ...
- C++11中右值引用和移动语义
目录 左值.右值.左值引用.右值引用 右值引用和统一引用 使用右值引用,避免深拷贝,优化程序性能 std::move()移动语义 std::forward()完美转发 容器中的emplace_back ...
- 使用Koa2搭建web项目
随着Node.js的日益火热,各种框架开始层出不穷的涌现出来,Node.js也开始逐渐的被应用到处理服务端请求的场景中.搭建Web项目的框架也随之开始出现——express.koa.koa2.egg等 ...
- Maven 映像
国内连接maven官方的仓库更新依赖库,网速一般很慢,收集一些国内快速的maven仓库镜像以备用. ====================国内OSChina提供的镜像,非常不错=========== ...
- C# 在同一个项目里启动不同的类文件
比如有两个类文件分别为 Person.cs 和 Enum.cs : using System; using person; namespace HelloWorld { class HelloWorl ...
- 1000. A-B
1000. A-B -----> http://soj.me/1000 Constraints Time Limit: 1 secs, Memory Limit: 32 MB Descripti ...
- VM CentOS 问题汇总
1. 锁定文件失败 / 模块启动失败 如下图问题: 原因分析: 虚拟机为了防止有多虚拟机共用一个虚拟磁盘(就是后 缀为.vmdk那个文件)造成数据的丢失等问题,每次启动虚拟机时会给每个虚拟磁盘加一个磁 ...