• Linux—服务管理三种方式(chkconfig和service和systemctl)


    一、chkconfig 介绍

    二、service 介绍

    1、常见 service 命令

    [root@localhost ~]# service supervisord stop
    [root@localhost ~]# service supervisord start
    [root@localhost ~]# service supervisord status
    [root@localhost ~]# service --status-all            # 查看Linux所有服务的运行状态

    三、systemctl 介绍

    1、常见 systemctl 命令

    [root@localhost ~]# systemctl stop supervisord
    [root@localhost ~]# systemctl start supervisord
    [root@localhost ~]# systemctl status supervisord
    [root@localhost ~]# systemctl restart supervisord
    [root@localhost ~]# systemctl is-active supervisord         # 查看服务是否运行
     
    [root@localhost ~]# systemctl enable supervisord            # 设置服务允许开机启动
    [root@localhost ~]# systemctl disable supervisord           # 设置服务禁止开机启动
    [root@localhost ~]# systemctl is-enabled supervisord        # 查看服务是否设置为开机启动,得到的值可以是enable、disable或static,这里的 static 它是指对应的 Unit 文件中没有定义[Install]区域,因此无法配置为开机启动服务。
    [root@localhost ~]# systemctl daemon-reload                 # 添加.service文件后,或者变更.service文件设置后,需要执行一下这个
      
    [root@localhost ~]# systemctl list-unit-files                      # 查看开机启动项
    [root@localhost ~]# systemctl list-unit-files | grep 程序名称       # 查看某些服务开机启动状态
    [root@localhost ~]# systemctl list-unit-files | grep enable        # 查看哪些为开机启动服务
    [root@localhost ~]# systemctl list-units --type=service            # 查看所有已启动的服务
    [root@localhost ~]# systemctl --failed                             # 查看启动失败的服务列表
     
    [root@localhost ~]# systemctl mask supervisord                     # 注销supervisord服务
    [root@localhost ~]# systemctl unmask supervisord                   # 取消注销supervisord服务
    
    [root@localhost ~]# systemctl get-default                      # 获得当前的运行级别
    [root@localhost ~]# systemctl set-default multi-user.target    # 设置默认的运行级别为mulit-user,即开机不开启图形
    [root@localhost ~]# systemctl set-default graphical.target     # 设置默认的运行级别为mulit-user,即开机启动图形
    [root@localhost ~]# systemctl isolate multi-user.target	       # 在不重启的情况下,切换到运行级别mulit-user下
    [root@localhost ~]# systemctl isolate graphical.target	       # 在不重启的情况下,切换到图形界面下

    2、常见 systemctl 命令

      

    借鉴:https://www.cnblogs.com/shijingjing07/p/9301590.html

    https://blog.csdn.net/u012486840/article/details/53161574

  • 相关阅读:
    css浮动布局小技巧
    dhtml
    js 图片轮播
    css 简单梯形
    css 平行四边
    activity添加切换动画之后出现的黑色背景问题
    Android 设置ImageView宽度固定,其高度按比例缩放适应
    白底黑字!Android浅色状态栏黑色字体模式(另)
    Adroid ViewPage+GridView实现每页6个元素,三页滑动切换
    Android View转换成图片保存
  • 原文地址:https://www.cnblogs.com/liuhaidon/p/11452072.html
Copyright © 2020-2023  润新知