1.肯定是否安装systemd及其版本socket
# systemctl –versionhibernate
2.肯定systemd和systemctl的二进制文件和库文件的安装位置rest
# whereis systemd接口
# whereis systemctl进程
3.肯定systemd是否运行内存
# ps -eaf | grep [s]ystemdci
4.分析systemd启动进程get
# systemd-analyzeit
5.分析启动时各个进程花费的时间io
# systemd-analyze blame
6. 分析启动时的关键链
# systemd-analyze critical-chain
7.列出全部可用单元
# systemctl list-unit-files
8.列出全部运行中单元
# systemctl list-units
9.列出全部失败单元
# systemctl --failed
10. 肯定某个单元(如 nfs.service)是否启用
# systemctl is-enabled nfs.service
11.肯定某个单元或服务是否运行
# systemctl status nfs.service
12. 列出全部服务(包括启用的和禁用的)
# systemctl list-unit-files --type=service
13.启动、重启、中止、重载服务及肯定服务(如 nfs.service)状态
# systemctl start nfs.service
# systemctl restart nfs.service
# systemctl stop nfs.service
# systemctl reload nfs.service
# systemctl status nfs.service
--注:
1)Systemctl的start,restart,stop和reload命令,终端并不输出任何相关信息,但能够经过status命令获取。
14.激活并配置服务自启和禁用服务
# systemctl is-active nfs.service
# systemctl enable nfs.service
# systemctl disable nfs.service
15.屏蔽(禁止任何方式启动服务,其比disabled做用更强)或解除屏蔽服务
# systemctl mask nfs.service
# systemctl unmask nfs.service
16.杀死服务
# systemctl kill nfs
# systemctl status nfs
17.列出全部系统挂载点
# systemctl list-unit-files --type=mount
18.挂载、卸载、从新挂载、重载系统挂载点和肯定系统挂载点状态
# systemctl start tmp.mount
# systemctl stop tmp.mount
# systemctl restart tmp.mount
# systemctl reload tmp.mount
# systemctl status tmp.mount
19. 启动时激活、启用(自动挂载)或禁用挂载点
# systemctl is-active tmp.mount
# systemctl enable tmp.mount
# systemctl disable tmp.mount
20.屏蔽(使其不能启用)或解屏蔽挂载点
# systemctl mask tmp.mount
# systemctl unmask tmp.mount
21. 列出全部可用套接字
# systemctl list-unit-files --type=socket
22. 启动、重启、中止、重载套接字并确认其状态
# systemctl start cups.socket
# systemctl restart cups.socket
# systemctl stop cups.socket
# systemctl reload cups.socket
# systemctl status cups.socket
23.系统启动时激活套接口,并启用(自启)或禁用该套接字
# systemctl is-active cups.socket
# systemctl enable cups.socket
# systemctl disable cups.socket
24.屏蔽(使其不能启动)或解屏蔽套接字
# systemctl mask cups.socket
# systemctl unmask cups.socket
25.获取某个服务的CPU配额
# systemctl show -p CPUShares nfs.service
26.限制某个服务的CPU配额为2000
# systemctl set-property nfs.service CPUShares=2000
# systemctl show -p CPUShares nfs.service
--注:
1)当为某个服务设置CPU配额时,系统会以服务名为名字建立一个目录(如 nfs.service),其中包含一个名为90-CPUShares.conf的文件,该文件包含CPUShare限制的相关信息,能够用以下方式查看该文件。
# vi /etc/systemd/system/nfs.service.d/90-CPUShares.conf
27. 肯定某个服务的全部配置信息
# systemctl show nfs
28. 分析某个服务的关键链
# systemd-analyze critical-chain nfs.service
29.获取某个服务的依赖性关系
# systemctl list-dependencies nfs.service
30.按等级列出控制组
# systemd-cgls
31.按CPU、内存、输入和输出列出控制组
# systemd-cgtop
32.进入系统救援模式
# systemctl rescue
33.进入紧急模式
# systemctl emergency
34. 确认当前的运行等级
# systemctl get-default
35.进入相应运行等级
--图形模式(5)
# systemctl isolate runlevel5.target
或
# systemctl isolate graphical.target
--多用户模式(3)
# systemctl isolate runlevel3.target
或
# systemctl isolate multiuser.target
36.设置默认运行等级
# systemctl set-default runlevel3.target
或
# systemctl set-default runlevel5.target
37.使系统重启、中止、挂起、休眠或进入混合睡眠
# systemctl reboot
# systemctl halt
# systemctl suspend
# systemctl hibernate
# systemctl hybrid-sleep
--注:
1)Runlevel 0 : 关闭系统。
2)Runlevel 1 : 救援维护模式。
3)Runlevel 3 : 多用户,无图形模式。
4)Runlevel 4 : 系统未使用,保留。
5)Runlevel 5 : 多用户,图形化模式。
6)Runlevel 6 : 关闭并重启系统。