zoukankan      html  css  js  c++  java
  • Linux 服务管理

    Linux里面的第一个进程,是整个系统的父进程。

    在RHEL6版本之前,包括RHEL6,采用的第一个进程叫做init。通过init进程启动的后续进程都是串行启动的。

    在RHEL7版本,采用第一个进程叫做systemd。该进程相比于init来说,采用并行方式启动后续进程。


    systemd 管理服务操作

    systemd管理的内容不仅仅有service,systemd管理的单位是unit,service只是unit中的一种。

    systemctl status sshd.service     # 查看服务的状态
    
    systemctl stop sshd.service       # 停止服务
    
    systemctl start sshd.service      # 启动服务
    
    systemctl restart sshd.service    # 重启服务
    
    systemctl enable sshd.service 	  # 设值服务开机自启
    
    systemctl disable sshd.service    # 设值服务开机不自启
    
    systemctl mask sshd.service       # 锁定改服务,这个时候start和restart等操作无效
    
    systemctl unmask sshd.service 	  # 解除该服务的锁定
    
    systemctl is-enabled sshd.service # 查看当前服务是否为开机自启
    
    systemctl is-active sshd.service  # 查看当前服务是否处于活跃状态
    

    systemd管理target

    target是由服务组成的一类启动目标,systemd可以设置启动目标,如果systemd指定了一个target作为启动目录,那么下次系统启动的时候就会启动target里面的所有服务。

    systemctl isolate multi-user.target # 临时切换到字符界面
    
    systemctl isolate graphical.target   # 临时切换到图形界面
    
    systemctl get-default                        # 查看下次开机启动加载哪个target
    
    systemctl set-default multi-user.target # 修改下次开机启动的target
    
  • 相关阅读:
    bashrc的加载
    无奈卸载Clover 转投TotalCommand
    Hash Table Benchmarks
    linux下编译lua
    可变参数的传递问题
    vector 之 find 重载
    Shell统计报表表格生成
    Shell字符串使用十进制转换
    No module named BeautifulSoup
    Multi Thread.
  • 原文地址:https://www.cnblogs.com/shu-sheng/p/13035435.html
Copyright © 2011-2022 走看看