• Centos 7 添加开机启动


    1、添加启动服务

    添加docker开机启动服务

    [root@localhost ~]# systemctl enable docker.service
    Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

    2、添加启动脚本

    1、编写脚本

    [root@localhost ~]# vi ping_route_donot_del.sh
    ping 10.47.85.129 &
    [root@localhost ~]# chomd +x ping_route_donot_del.sh

    2、添加开机启动

    [root@localhost ~]# vi /etc/rc.d/rc.local
    #!/bin/bash
    # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
    #
    # It is highly advisable to create own systemd services or udev rules
    # to run scripts during boot instead of using this file.
    #
    # In contrast to previous versions due to parallel execution during boot
    # this script will NOT be run after all other services.
    #
    # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
    # that this script will be executed during boot.

    touch /var/lock/subsys/local
    /root/ping_route_donot_del.sh

    3、赋予开机启动权限

    [root@localhost ~]#chmod +x /etc/rc.d/rc.local

  • 相关阅读:
    数组的地址和vector数组的地址
    字节跳动 测试开发工程师 面经
    最短路径树
    SPFA
    树的直径
    树的重心
    CF1401D Maximum Distributed Tree
    期望简述
    CF723E One-Way Reform
    CF1409E Two Platforms
  • 原文地址:https://www.cnblogs.com/hzw97/p/11758199.html
Copyright © 2020-2023  润新知