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