在早期的红帽系统中,如果想管理一个服务的状态时,比如查看ssh服务的当前状态,启用,停止或是重启此服务时,需要使用service sshd {status,start,stop,reload}。在RHEL7中,使用systemctl命令进行管理不同类型的服务对象(systemd objects),我们称为until。

  systemctl  -t help 可以显示出不同类型的until

Controlling Services and Daemons_Controlling Services

 

 例如:列出active状态的服务单元

Controlling Services and Daemons_Controlling Services_02

 

 例如显示出sshd服务的状态

Controlling Services and Daemons_Controlling Services_03

 例如 停止ssh服务 类似于service sshd stop

 Controlling Services and Daemons_Controlling Services_04

  例如 如果想使得ssh服务在下次重启系统时自动启动(automatic start at boot time) 类似于chkconfig sshd on

  Controlling Services and Daemons_Controlling Services_05

 列出常见systemctl命令表格:

 Controlling Services and Daemons_Controlling Services_06