zoukankan      html  css  js  c++  java
  • debian9 rc.local开机启动文件不存在解决方案 并开机启动tomcat容器

    由于某些软件并没有增加开启启动的服务,很多时候需要手工添加,一般我们都是推荐添加命令到 /etc/rc.local 文件,但是 Debian 9 默认不带 /etc/rc.local 文件,而 rc.local 服务却还是自带的

    cat /lib/systemd/system/rc.local.service


    #  This file is part of systemd.
    #
    #  systemd is free software; you can redistribute it and/or modify it
    #  under the terms of the GNU Lesser General Public License as published by
    #  the Free Software Foundation; either version 2.1 of the License, or
    #  (at your option) any later version.
    
    # This unit gets pulled automatically into multi-user.target by
    # systemd-rc-local-generator if /etc/rc.local is executable.
    [Unit]
    Description=/etc/rc.local Compatibility
    ConditionFileIsExecutable=/etc/rc.local
    After=network.target
    
    [Service]
    Type=forking
    ExecStart=/etc/rc.local start
    TimeoutSec=0
    RemainAfterExit=yes
    GuessMainPID=no

    默认情况下这个服务关闭状态

    systemctl status rc-local

    ● rc-local.service - /etc/rc.local Compatibility
       Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
      Drop-In: /lib/systemd/system/rc-local.service.d
               └─debian.conf
       Active: inactive (dead)

    为了解决这个问题,需要手工添加一个 /etc/rc.local 文件  内容如下:

    nano rc.local
    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.

      #这个是开机启动tomcat的脚本

      sh /server-home/tomcat8.5.32/bin/startup.sh restart

    exit 0


    设置权限

    chmod +x /etc/rc.local

    启动rc.local

    systemctl start rc-local  
    
    
    ● rc-local.service - /etc/rc.local Compatibility
       Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
      Drop-In: /lib/systemd/system/rc-local.service.d
               └─debian.conf
       Active: active (exited) since Thu 2017-08-03 09:41:18 UTC; 14s ago
      Process: 20901 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)
    
    Aug 03 09:41:18 xtom-proxy systemd[1]: Starting /etc/rc.local Compatibility...
    Aug 03 09:41:18 xtom-proxy systemd[1]: Started /etc/rc.local Compatibility.
  • 相关阅读:
    h5 在全屏iphonex中的适配
    http响应状态码301和302
    http协议
    画图-drawpoint and drawpath
    Android-自己定义meta-data扩展数据
    iOS应用公布Invalid Binary问题解决方式
    在线工具集合(新增cron quartz表达式在线生成……)
    SSH 占用数据库连接不释放问题
    Oracle数据库获取uuid函数
    Android Message handling (based on KK4.4)
  • 原文地址:https://www.cnblogs.com/light-zhang/p/9268030.html
Copyright © 2011-2022 走看看