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. mongodb中Gson和java##Bean对象转化类

    此类使用感觉比较繁琐, 每个字段加注解才可以使用, 不如mongoTemplate使用方便, 但如果使用mongo客户端的话, 还是比手动拼接快一点, 所以贴在这儿 package com.iwher ...

  2. ArrayList的subList方法

    参考博文使用java.util.List.subList时最好小心点 List接口中定义: List<E> subList(int fromIndex, int toIndex); 英文注 ...

  3. Spanner:谷歌新一代全球部署的列式数据库

    Spanner 是一个可扩展的.全球分布式的数据库,提供分布式ACID. 架构 universe:一个部署的实例成为universe,目前谷歌有3个,分别为开发/测试/线上 Zone:一个数据中心,相 ...

  4. Servlet多文件上传方法

    1. 通过getInputStream()取得上传文件. 001 /** 002  * To change this template, choose Tools | Templates 003  * ...

  5. linux tar 命令

    tar [-cxtzjvfpPN] 文件与目录 ....参数:-c :建立一个压缩文件的参数指令(create 的意思):-x :解开一个压缩文件的参数指令!-t :查看 tarfile 里面的文件! ...

  6. haproxy配置文件详解--转

    原始出处:http://itnihao.blog.51cto.com/1741976/915537 #/usr/local/sbin/haproxy -f /etc/haproxy/haproxy.c ...

  7. activiti 临时笔记mark

    public class TenMinuteTutorial { public static void main(String[] args) { // Create Activiti process ...

  8. Dev中控件的js事件代码放在form标签中存在问题

    Dev中控件的js事件代码放在form标签中会获取不到(head标签中有其他js代码,未验证是否是这个问题)

  9. select SCOPE_IDENTITY()用法

    select SCOPE_IDENTITY() 返回上面操作的数据表最后row的IDENTITY 列的值: 返回插入到同一作用域中的 IDENTITY 列内的最后一个 IDENTITY 值.一个作用域 ...

  10. UIWebView 展示GIF/image

    代码: [web loadData:self.gifDataArr[index] MIMEType:@"image/gif" textEncodingName:@"&qu ...