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的更多相关文章

  1. insserv: warning: script 'lampp' missing LSB tags and overrides

    https://ubuntuforums.org/showthread.php?t=2327011 1.方法一,编辑rc.loacl脚本 Ubuntu开机之后会执行/etc/rc.local文件中的脚 ...

  2. insserv: warning: script 'busybox-httpd' missing LSB tags and overrides

    /********************************************************************************* * insserv: warnin ...

  3. 解决ubuntu的chkconfig[/sbin/insserv 无法找到路径问题]

    http://www.cnblogs.com/lost-1987/archive/2012/10/17/2727285.html 今天在虚拟机里做DRBD实验,使用chkconfig管理服务的时候,出 ...

  4. Linux下tomcat服务

    一:Linux下tomcat服务的启动.关闭与错误跟踪,使用PuTTy远程连接到服务器以后,通常通过以下几种方式启动关闭tomcat服务:切换到tomcat主目录下的bin目录(cd usr/loca ...

  5. linux下tomcat服务的启动、关闭与错误跟踪

    linux下tomcat服务的启动.关闭与错误跟踪,远程连接到服务器以后,通常通过以下几种方式启动关闭tomcat服务: 1).启动tomcat服务 进入tomcat主目录下的bin目录,然后执行如下 ...

  6. linux下启动和关闭tomcat服务的方式

    Linux下tomcat服务的启动.关闭与错误跟踪,通常通过以下几种方式启动关闭tomcat服务: 切换到tomcat主目录下的bin目录 启动tomcat服务 生产模式: 方式一:直接启动 ./st ...

  7. linux下启动tomcat服务

     Linux下tomcat服务的启动.关闭与错误跟踪,使用PuTTy远程连接到服务器以后,通常通过以下几种方式启动关闭tomcat服务:切换到tomcat主目录下的bin目录(cd usr/local ...

  8. linux下启动tomcat服务的命令是什么

    Linux下tomcat服务的启动.关闭与错误跟踪,使用PuTTy远程连接到服务器以后,通常通过以下几种方式启动关闭tomcat服务:切换到tomcat主目录下的bin目录(cd usr/local/ ...

  9. 配置 Tomcat 服务 和 自启动

    如果我们使用war 包进行部署项目的时候,需要把包放进Tomcat的目录下,为了使我们的服务能够在服务器重启的时候自动启动起来,我们需要把Tomcat设置成自起服务. 配置 Tomcat 服务 新建服 ...

随机推荐

  1. 数据库-转换sql语句

    文章描述:主要说明转换成SQL语句的过程.----必要信息(数据库名,表名,条件)转换成SQL语句 一些界面上数据增删改查的操作往往只需要输入一数据库名,表名,加条件就可以进行数据查询了,在这背后是怎 ...

  2. tensorflow语法笔记

    1.如何理解 tf.reduce_max或者 tf.reduce_mean中对Tensor和高维矩阵的坐标轴axis的选择的操作 tf.reduce_mean( input_tensor, axis= ...

  3. java中的复制数组arraycopy()

    System.arraycopy();//静态方法,在System类中定义,注意copy首字母是小写的 例子: int[] a = {1,2,3,4,5}; int[] b = {9,8,7,6}; ...

  4. Kaggle(一):房价预测

    Kaggle(一) 房价预测 (随机森林.岭回归.集成学习)  项目介绍:通过79个解释变量描述爱荷华州艾姆斯的住宅的各个方面,然后通过这些变量训练模型, 来预测房价.   kaggle项目链接:ht ...

  5. Qt5 编程基础

    Qt 是一个C++ GUI应用框架,Qt 具有良好的可移植性支持大多数桌面和移动操作系统并常用于嵌入式开发. Qt的发行版分为商业版和开源版,提供了Qt Creator作为轻量级IDE. Hello ...

  6. 我所了解的Hibernate注解

    一,首先需要导入支持注解开发的jar包: hibernate-annotations.jar hibernate-commons-annotations.jar (Hibernate中支持注解开发的j ...

  7. redis on windows

    https://github.com/MSOpenTech/redis 下载解压 在/bin/release里还有一个压缩包,这个压缩包是生成好的 解压 运行redis-server 乌拉乌拉说了一堆 ...

  8. js,需要更多源字符

      里面有的括号没写完 没有关闭 使整个js都不能用 vs2010安装个下面JS插件,更好的分层, https://marketplace.visualstudio.com/items?itemNam ...

  9. Hive配置文件hive-site.xml

    <configuration> <property> <name>hive.metastore.warehouse.dir</name> <val ...

  10. AutoFac使用方法总结三:生命周期

         生命周期 AutoFac中的生命周期概念非常重要,AutoFac也提供了强大的生命周期管理的能力.     AutoFac定义了三种生命周期: Per Dependency Single I ...