zoukankan      html  css  js  c++  java
  • LINUX系统中设置开机自动执行命令

    ###

    1、开机自动执行命令配置文件位置

    [root@wx-local01 ~]# cd  /etc/rc.d/
    
    
    [root@wx-local01 rc.d]# ls -l  /etc/rc.d/
    总用量 4
    drwxr-xr-x. 2 root root 107 9月   5 10:40 init.d
    drwxr-xr-x. 2 root root  45 11月 17 2020 rc0.d
    drwxr-xr-x. 2 root root  45 11月 17 2020 rc1.d
    drwxr-xr-x. 2 root root  45 11月 17 2020 rc2.d
    drwxr-xr-x. 2 root root  72 5月  26 14:02 rc3.d
    drwxr-xr-x. 2 root root  72 5月  26 14:02 rc4.d
    drwxr-xr-x. 2 root root  72 5月  26 14:02 rc5.d
    drwxr-xr-x. 2 root root  45 11月 17 2020 rc6.d
    -rwxr-xr-x. 1 root root 881 5月  27 16:06 rc.local
    [root@wx
    -local01 rc.d]# tree /etc/rc.d/ /etc/rc.d/ ├── init.d │ ├── functions │ ├── mysql -> /home/wx/mysql/support-files/mysql.server │ ├── netconsole │ ├── network │ ├── README │ └── syschronzed_date ├── rc0.d │ ├── K50netconsole -> ../init.d/netconsole │ └── K90network -> ../init.d/network ├── rc1.d │ ├── K50netconsole -> ../init.d/netconsole │ └── K90network -> ../init.d/network ├── rc2.d │ ├── K50netconsole -> ../init.d/netconsole │ └── S10network -> ../init.d/network ├── rc3.d │ ├── K50netconsole -> ../init.d/netconsole │ ├── S10network -> ../init.d/network │ └── S63syschronzed_date -> ../init.d/syschronzed_date ├── rc4.d │ ├── K50netconsole -> ../init.d/netconsole │ ├── S10network -> ../init.d/network │ └── S63syschronzed_date -> ../init.d/syschronzed_date ├── rc5.d │ ├── K50netconsole -> ../init.d/netconsole │ ├── S10network -> ../init.d/network │ └── S63syschronzed_date -> ../init.d/syschronzed_date ├── rc6.d │ ├── K50netconsole -> ../init.d/netconsole │ └── K90network -> ../init.d/network └── rc.local 8 directories, 24 files

    2、设置开机自启动命令

    [root@wx-local01 rc.d]# vim /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
    
    #开机执行脚本启动harbor
    sh /scripts/shell/start_harbor/power_on_self_starting_harbor.sh

    3、设置执行权限【不设置执行权限,启动后不执行文件中内容】

    [root@wx-local01 rc.d]# chmod +x /etc/rc.d/rc.local

    ###

  • 相关阅读:
    nodejs-supervisor
    javascript数组操作(创建、元素删除、数组的拷贝)
    mysql索引优化-order/group
    php-kafka
    大流量高并发解决方案
    MySQL数据类型和常用字段属性总结
    php一致性hash算法
    面试中的排序算法总结
    PHP的运行机制与原理(底层)
    Mysql中的锁机制
  • 原文地址:https://www.cnblogs.com/faithH/p/15228832.html
Copyright © 2011-2022 走看看