美文网首页
centos 自启动设置

centos 自启动设置

作者: 一二追 | 来源:发表于2019-08-22 10:59 被阅读0次

    一.chkconfig

    1.配置服务自启动命令

    chkconfig servicename on/off

    5.如果只想看指定的服务,只需要在 “–-list” 之后加上服务名就好了,比如查看httpd服务是否为自动启动:

    [root@host ~]# chkconfig --list httpd

    httpd          0:off  1:off  2:off  3:off  4:off  5:off  6:off

    此时0~6均为off,则说明httpd服务不会在系统启动的时候自动启动。我们输入:

    [root@host ~]# chkconfig httpd on

    则此时为:

    [root@host ~]# chkconfig --list httpd

    httpd          0:off  1:off  2:on    3:on    4:on    5:on    6:off

    这个时候2~5都是on,就表明会自动启动了。

    二.修改 /etc/rc.d/rc.local 这个文件

    1、赋予脚本可执行权限(/opt/script/StartTomcat.sh是你的脚本路径)

       chmod +x /opt/script/StartTomcat.sh

    2、打开/etc/rc.d/rc.local文件,在末尾增加如下内容

    3、在centos7中,/etc/rc.d/rc.local的权限被降低了,所以需要执行如下命令赋予其可执行权限

        chmod +x /etc/rc.d/rc.local

    相关文章

      网友评论

          本文标题:centos 自启动设置

          本文链接:https://www.haomeiwen.com/subject/giogsctx.html