首页 > 其他分享 >从0到1一步一步玩转openEuler--21 openEuler 管理服务-改变运行级别

从0到1一步一步玩转openEuler--21 openEuler 管理服务-改变运行级别

时间:2023-02-21 22:33:35浏览次数:28  
标签:target 一步 systemctl active loaded openEuler root 21

21 管理服务-改变运行级别

21.1 Target和运行级别

systemd用目标(target)替代了运行级别的概念,提供了更大的灵活性,如您可以继承一个已有的目标,并添加其他服务,来创建自己的目标。表7列举了systemd下的目标和常见runlevel的对应关系。

表 7 运行级别和systemd目标

运行级别 systemd目标(target) 描述
runlevel0.target,poweroff.target 关闭系统。
1, s, single runlevel1.target,rescue.target 单用户模式。
2, 4 runlevel2.target,runlevel4.target,multi-user.target 用户定义/域特定运行级别。默认等同于3。
3 runlevel3.target,multi-user.target 多用户,非图形化。用户可以通过多个控制台或网络登录。
5 runlevel5.target,graphical.target 多用户,图形化。通常为所有运行级别3的服务外加图形化登录。
6 runlevel6.target,reboot.target 重启系统。
emergency emergency.target 紧急Shell

21.2 查看系统默认启动目标

查看当前系统默认的启动目标,命令如下:

# systemctl get-default

例如示例命令如下:

[root@superman-21 ~]# systemctl get-default
multi-user.target
[root@superman-21 ~]# 

21.3 查看当前系统所有的启动目标

查看当前系统所有的启动目标,命令如下:

# systemctl list-units --type=target

例如示例命令如下:

[root@superman-21 ~]# systemctl list-units --type=target
  UNIT                  LOAD   ACTIVE SUB    DESCRIPTION                        
  basic.target          loaded active active Basic System
  bluetooth.target      loaded active active Bluetooth Support
  getty.target          loaded active active Login Prompts
  local-fs-pre.target   loaded active active Preparation for Local File Systems
  local-fs.target       loaded active active Local File Systems
  multi-user.target     loaded active active Multi-User System
  network-online.target loaded active active Network is Online
  network-pre.target    loaded active active Preparation for Network
  network.target        loaded active active Network
  nfs-client.target     loaded active active NFS client services
  paths.target          loaded active active Path Units
  remote-fs-pre.target  loaded active active Preparation for Remote File Systems
  remote-fs.target      loaded active active Remote File Systems
  rpc_pipefs.target     loaded active active rpc_pipefs.target
  rpcbind.target        loaded active active RPC Port Mapper
  slices.target         loaded active active Slice Units
  sockets.target        loaded active active Socket Units
  sound.target          loaded active active Sound Card
  sshd-keygen.target    loaded active active sshd-keygen.target
  swap.target           loaded active active Swaps
  sysinit.target        loaded active active System Initialization
  timers.target         loaded active active Timer Units

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.
22 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@superman-21 ~]# 

21.4 改变默认目标

改变系统默认的目标,在root权限下执行如下命令:

# systemctl set-default name.target

例如示例命令如下:

[root@superman-21 ~]# systemctl set-default multi-user.target
[root@superman-21 ~]# 

21.5 改变当前目标

改变当前系统的目标,在root权限下执行如下命令:

# systemctl isolate name.target

例如示例命令如下:

[root@superman-21 ~]# systemctl isolate rescue.target
[root@superman-21 ~]#

21.6 切换到救援模式

改变当前系统为救援模式,在root权限下执行如下命令:

# systemctl rescue

例如示例命令如下:

[root@superman-21 ~]# systemctl rescue
[root@superman-21 ~]# 

这条命令和“systemctl isolate rescue.target”类似。命令执行后会在串口有如下打印信息:

You are in rescue mode. After logging in, type "journalctl -xb" to viewsystem logs, systemctl reboot" to reboot, "systemctl default" or "exit"to boot into default mode.
Give root password for maintenance
(or press Control-D to continue):

image-20221211195017526说明: 用户需要重启系统,从救援模式进入正常模式。

21.7 切换到紧急模式

改变当前系统为紧急模式,在root权限下执行如下命令:

# systemctl emergency

这条命令和“systemctl isolate emergency.target”类似。命令执行后会在串口有如下打印信息:

You are in emergency mode. After logging in, type "journalctl -xb" to viewsystem logs, systemctl reboot" to reboot, "systemctl default" or "exit"to boot into default mode.
Give root password for maintenance
(or press Control-D to continue):

例如示例命令如下:

[root@superman-21 ~]# systemctl emergency
[root@superman-21 ~]# 

image-20221211195017526 说明: 用户需要重启系统,从紧急模式进入正常模式。

标签:target,一步,systemctl,active,loaded,openEuler,root,21
From: https://blog.51cto.com/u_237826/6077089

相关文章

  • 2023/02/21刷题
    A.k-String链接A.k-String我们先统计全部字母的数量,然后根据k的值来确定k次重复的每次字母的数量,之后生成字符串#include<iostream>#include<algorithm>#inclu......
  • 2.21学习体会
    今天学习了“添加”的内容:packagedailysummer;importjava.sql.DriverManager;importjava.sql.Connection;publicclassMain{publicStringtitle;publicString......
  • 2023年2.21软件工程日报
    今天一共有7节课,在上午,我们系统学习了数据库原理,知道了数据库的概论,知道了数据库系统的特点,还有数据管理技术的发展。数据库系统的特点;数据结构化共享性高,易于扩充数......
  • 2023,2,21日
    今天早上上了英语课,数据库原理,对数据库原理的学习格外的重视,上课听杨老师讲解他的开发流程,感触很深,对数据库的操作工作以后可能得用orm,感到需要学得东西还很多。今天和舍......
  • 2023.2.21——软件工程日报
    所花时间(包括上课):8.5h代码量(行):0行博客量(篇):2篇今天,上午上了英语提高与数据库原理及应用教程,下午上了python,晚上学习了数学建模。我了解到的知识点:1.数据库设置数据类型......
  • 每日记录2023.02.21(二)
    今天学习了servlet的使用,实现了数据的添加和更新,但是遇到了404和500的问题,发现404的我问题可以在jsp文件中的<formaction="/StudentBiz"method="get">加一个”/“就可以......
  • 2023年2月21号
    今天自己手动创建一个新项目并连接上了数据库。                   今天学习时间是一个小时,最近几天准备把代码写一下,争取在这周......
  • 2月21日每日总结
    今日学习了JavaScript相关内容的学习,今日学习的内容是变量和数据类型JavaScript是一门弱类型语言,变量可以存放不同类型的值变量名需要遵循如下规则:组成字符可以是任何字母......
  • 2023.2.21周二每日总结
    今天依旧在钻研增删改查里面的增,白天上课到时候听了数据库原理老师的课,对数据库的操作有了更进一步的认知,逐渐明白如何往数据库中添加和修改信息,但是这和从网页录入的信......
  • 每日总结2023/2/21
    今天学习了AndroidStudio中每个部分的作用,各个部分代码的放置位置,了解到图片存放位置等在进入AndroidStudio后,等待启动完成  需将左上角Android换为Project  ......