RHEL7运行级别和服务

一 RHEL7运行级别

systemd使用“target”而不是运行级。默认情况下,有两个主要

target:multi-user.target:类似于运行级别3

graphical.target:类似于运行级5

1)查看当前默认目标,运行:

systemctl get-default

2)设置一个默认目标,运行:

systemctl set-default TARGET.target

3)查看默认运行级别

[root@RHEL7 ~]# systemctl get-default

multi-user.target

4)设置默认的运行级别

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

rm '/etc/systemd/system/default.target'

ln -s '/usr/lib/systemd/system/multi-user.target' '/etc/systemd/system/default.target'

5)切换运行级别

[root@RHEL7 ~]# systemctl isolate multi-user.target

二 RHEL7服务

systemd 的主要的命令行工具是systemctl

注意:servic和 chkconfig 在引进systemd 照常可以使用

systemctl 的语法格式

systemctl start [服务名称]  启动 

systemctl restart [服务名称]   重新启动

systemctl stop [服务名称]   停止

systemctl status [服务名称]   状态查询

systemctl enable  [服务名称]  开机自启

systemctl disable  [服务名称]   服务开机不启动

sudo systemctl kill httpd.service有时候,该命令可能没有响应,服务停不下来。这时候就不得不"杀进程"了,向正在运行的进程发出kill信号。

查看所有服务的状态:systemctl list-unit-files

锁定服务:systemctl mask sshd   #此时这个服务不可以进行操作

解除服务的锁定:systemctl unmask sshd

列出服务间的依赖关系:systemctl list-dependencies

posted on 2017-02-28 11:48  石下江的太阳光  阅读(213)  评论(0编辑  收藏  举报

导航