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. 然后linux设置脚本开机自启

相关文章:

  • 2021-12-23
  • 2021-08-01
  • 2021-05-20
  • 2022-12-23
  • 2022-01-19
  • 2022-02-24
  • 2022-02-11
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-19
  • 2022-02-05
  • 2021-05-07
  • 2021-11-22
  • 2021-12-12
  • 2021-07-01
相关资源
相似解决方案