zoukankan      html  css  js  c++  java
  • Linux : How to add rc.local in Debian 9

    rc.local在老版本的debian系统中是有的,6版本以后,这个就没有了,这里记录一下debian 9设置开机启动脚本的方式:    

    新增文件:

    vi /etc/systemd/system/rc-local.service
    

        编辑内容:

    [Unit]
    Description=/etc/rc.local
    ConditionPathExists=/etc/rc.local
    
    [Service]
    Type=forking
    ExecStart=/etc/rc.local start
    TimeoutSec=0
    StandardOutput=tty
    RemainAfterExit=yes
    SysVStartPriority=99
    
    [Install]
    WantedBy=multi-user.target

        新增文件:

    vi /etc/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.
    
    exit 0
    

      

      添加权限:

    chmod +x /etc/rc.local
    

      设置到系统启动:

    systemctl enable rc-local
    

      启动脚本:

    systemctl start rc-local.service
    

      检查服务状态:

    systemctl status rc-local.service
    

      上面你已经成功的创建了一个系统启动脚本,并且原文地址如下:  

    原文地址:http://www.itechlounge.net/2017/10/linux-how-to-add-rc-local-in-debian-9/

    接下来你就可以在/etc/rc.loacl中的exit前增加任意你想启动的脚本了,比如:

    cd /home/wjf/flypig
    sh run.sh
    

      

  • 相关阅读:
    Linux date自己实现代码
    Linux常用指令
    awk getline命令
    文档资料记录
    数学之美番外篇:平凡而又神奇的贝叶斯方法
    最小二乘法(ZZ)
    SpringMVC简单使用教程
    Oracle设置序列方法
    Bootstrap Table的使用详解
    Html中div块居中显示
  • 原文地址:https://www.cnblogs.com/SATinnovation/p/8672019.html
Copyright © 2011-2022 走看看