返回顶部

centos 7 /etc/rc.d/init.d/ 开机自动执行脚本

把“脚本文件”放在/etc/rc.d/init.d目录下:

添加脚本到开机自动启动项目中

cd /etc/rc.d/init.d
chkconfig --add xxx.sh
chkconfig xxx.sh on

注:xxx.sh为脚本文件

脚本文件中必须包含以下俩项:

  #chkconfig: 2345 10 90

  #description: ping10

第一行告诉chkconfig缺省启动的运行级以及启动和 停止的优先级。
第二行对服务进行描述,可以用\ 跨行注释。

posted @ 2020-03-02 14:28  御用闲人  阅读(2375)  评论(0编辑  收藏  举报