zoukankan      html  css  js  c++  java
  • Linux配置开机自启动执行脚本

    方法一:修改/etc/rc.local

    /etc/rc.local ,该文件为链接文件

    # ll /etc/rc.local 
    lrwxrwxrwx. 1 root root 13 Feb  5 10:03 /etc/rc.local -> rc.d/rc.local

    修改/etc/rc.local文件

    # tail -n 1 /etc/rc.local 
    /bin/bash /server/scripts/qidong.sh >/dev/null 2>/dev/null

    方法二:chkconfig管理

    # vim /etc/init.d/test 
    #!/bin/bash
    # chkconfig: 3 88 88
    /bin/bash /server/scripts/qidong.sh >/dev/null 2>/dev/null# chmod +x /etc/init.d/test

    添加到chkconfig,开机自启动

    # chkconfig --add test
    # chkconfig --list test
    test               0:off    1:off    2:off    3:on    4:off    5:off    6:off

    关闭开机启动

    # chkconfig test off
    # chkconfig --list test
    test               0:off    1:off    2:off    3:off    4:off    5:off    6:off

    从chkconfig管理中删除test

    # chkconfig --list test
    test               0:off    1:off    2:off    3:off    4:off    5:off    6:off
    
    # chkconfig --del test
    
    # chkconfig --list test
    service test supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add test')
    白虎
          Hello! I Am David.DU.
  • 相关阅读:
    2019/10/9 CSP-S 模拟测
    简单的面向对象
    魔术变量
    函数
    全局变量
    超级全局变量
    for循环
    while循环
    php数组排序
    python打造XslGenerator
  • 原文地址:https://www.cnblogs.com/whitetiger/p/14451222.html
Copyright © 2011-2022 走看看