linux設置腳本開機自啟


  1. 由於在centos7中/etc/rc.d/rc.local的權限被降低了,所以需要賦予其可執行權

    chmod +x /etc/rc.d/rc.local 
  2. 賦予腳本可執行權限
    假設/opt/script/autostart.sh是你的腳本路徑,給予執行權限

    chmod +x /opt/script/autostart.sh
  3. 打開/etc/rc.d/rc.local文件,在末尾增加如下內容
    /opt/script/autostart.sh
  4. 加入是自己寫的shell腳本,而且帶有參數執行例如startbatch start all需要把這個腳本cp /data/app/cassiatant/startbatch.sh  /etc/init.d/
  5. 然后


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM