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:我还是建议不要走所谓的一劳永逸,还是改上面的文件比较稳妥。反正我是按上面的成功了,一劳永逸的方法不成功,反而出了另外的一些问题。)

转载于:https://www.cnblogs.com/taomylife/p/9953625.html

Ubuntu做Tomcat服务:insserv: warning: script 'tomcat' missing LSB tags and overrides相关推荐

  1. Tomcat 服务:解决 Apache Tomcat 更新后 Tomcat9w.exe 无法启动 Tomcat 服务的问题

    解决 Tomcat9w.exe 无法启动 Tomcat 服务的问题/解决 Apache Tomcat 更新后 Apache Tomcat 9.0 Tomcat9 Properties 配置不匹配的问题 ...

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

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

  3. linux追踪tomcat报错信息,linux下tomcat服务的启动、关闭与错误跟踪

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

  4. linux下tomcat服务的相关命令

    2019独角兽企业重金招聘Python工程师标准>>> 一:Linux下tomcat服务的启动.关闭与错误跟踪,使用PuTTy远程连接到服务器以后,通常通过以下几种方式启动关闭tom ...

  5. Tomcat服务部署和优化

    文章目录 一.Tomcat介绍 1.1 什么是Tomcat 1.2 Tomcat的构成组件 1.2.1 Java Servlet 介绍 1.2.2 JSP介绍 1.3 Tomcat顶层架构 1.3.1 ...

  6. 解压版本的tomcat服务安装

    以下适合各个版本的tomcat(注意启动时8080端口要确保未被占用) 今天搭一个Tomcat服务器,为了方便决定将解压版(非windows的安装方式)的tomcat添加为一个windows服务. 环 ...

  7. 如何在Linux操作系统定时重启Tomcat服务?

    如何在Linux操作系统定时重启Tomcat服务? 背景: 正常情况下启动和关闭tomcat程序命令如下: /application/tomcat/bin/startup.sh /applicatio ...

  8. windows环境下下tomcat服务搭建

    windows服务器下tomcat服务搭建 安装jdk,配置环境变量 下载tomcat免安装版,解压包 cmd进入/bin,安装tomcat服务--service.bat install tomcat ...

  9. 启动tomcat服务

    目前有个java+mysql项目需部署到 鲲鹏系统,一番折腾后总算成功部署上去了,其操作和windows有本质区别,需要使用终端命令行,现将常用运维操作整理如下. Linux下tomcat服务的启动. ...

  10. linux下启动tomcat服务

    目前有个java+mysql项目需部署到 麒麟系统,一番折腾后总算成功部署上去了,其操作和windows有本质区别,需要使用终端命令行,现将常用运维操作整理如下. Linux下tomcat服务的启动. ...

最新文章

  1. 文献阅读方法 如何阅读英文文献 - 施一公(转)
  2. Sublime text3!行首,行尾,批量编辑!
  3. Linux01-bash脚本编程之六使用脚本选项及组合条件测试23
  4. ASP.NET学习6 XML文档的操作
  5. 揭开腾讯IDC节能环保黑科技
  6. nginx日志中文变成类型\xE9\xA6\x96\xE9\xA1\xB5-\xE6\x8E\xA8\xE8\x8D\x90的东西
  7. hdu 1564 Play a game
  8. Bootstrap datepicker 在弹出窗体modal中不工作
  9. 操作系统文件编程知识
  10. 华为P50真机谍照曝光:璀璨粉色机身 牢牢锁定女性用户
  11. jxl.read.biff.BiffException: Unable to recognize OLE stream解决方法
  12. windows如何更改字体
  13. 个人使用整理的部分测试数据整理-输入类2022
  14. 2022年最新版初级商业数字营销师直通车题库
  15. 基本知识 100040
  16. 12306 验证码代码分析
  17. HTML和CSS基础学习
  18. untiy Socket通信一篇通
  19. 第十四章 使用者的特殊 shell 与 PAM 模块
  20. PEP代码规范简单总结

热门文章

  1. poj 3667 Hotel 线段树 内存分配问题
  2. Mac新手使用技巧,键盘键位分布和快捷键
  3. Mac 如何保护您的数据安全?
  4. 如何在 Mac 上自动启用隐藏式字幕?
  5. PowerPhotos:Mac照片库管理软件
  6. Mac上功能强大图片查看编辑工具:zGallery
  7. mac启动盘已满,如何“瘦身”
  8. 亚马逊向GuardDuty服务添加三种新的威胁检测规则
  9. 前端后台的爱恨情仇——接口调试
  10. 6.7. exists, not exists