zoukankan      html  css  js  c++  java
  • Linux 设置程序开机自启动 (命令systemctl 和 chkconfig用法区别比较)

    之前在Linux centos 7 上安装了apache 和mysql,当时并没有设置开机自动启动。

    最近又重新练习网页,每次开机总是要手动启动httpd和mysqld,不方便,就想设置成开机自动启动apache和mysql。

    Linux centos 7 怎样设置开机自动启动httpd和mysqld服务呢?

    我在网上找到了下面两条命令:

    systemctl enable httpd.service

    systemctl enable mysqld.service

    如果要取消开机自动启动apache和mysql,则用下面的命令

    systemctl disable httpd.service
    systemctl disable mysqld.service

    可是,我想起了以前我看过开机自动运行httpd服务好像不是上面的命令,而是
    chkconfig –level 3 httpd on

    那么chkconfig 和systemctl 这两个命令又有什么区别与联系呢?

    我在网上找到了下面这个关于systemctl 和chkconfig 指令用法比较的表格

    任务 旧指令 新指令
    使某服务自动启动 chkconfig –level 3 httpd on systemctl enable httpd.service
    使某服务不自动启动 chkconfig –level 3 httpd off systemctl disable httpd.service
    检查服务状态 service httpd status systemctl status httpd.service
    显示所有已启动的服务 chkconfig –list systemctl list-units –type=service
    启动某服务 service httpd start systemctl start httpd.service
    停止某服务 service httpd stop systemctl stop httpd.service
    重启某服务 service httpd restart systemctl restart httpd.service
  • 相关阅读:
    Flex 与 Asp.Net 通过 Remoting 方式进行通讯 (三)
    Flex 与 Asp.Net 通过 Remoting 方式进行通讯 (四)
    操作Ini文件[摘抄]
    快速记忆五十音图 [转]
    最近比较烦
    话说中国足球
    如何有效的使用C#读取文件[转]
    关于男人的笑话[Joke About Man]
    体检
    [转]一个月赚5万美元国产共享软件开发者周奕
  • 原文地址:https://www.cnblogs.com/achengmu/p/9339559.html
Copyright © 2011-2022 走看看