3-11·RHEL7&CentOS7服務命令

1)服務狀態

1.檢查服務器服務狀態

[root@lee ~]# systemctl -t service 
UNIT                                   LOAD   ACTIVE SUB     DESCRIPTION
abrt-ccpp.service                      loaded active exited  Install ABRT coredump hook
abrt-oops.service                      loaded active running ABRT kernel log watcher
abrt-xorg.service                      loaded active running ABRT Xorg log watcher
abrtd.service                          loaded active running ABRT Automated Bug Reporting Tool
atd.service                            loaded active running Job spooling tools
auditd.service                         loaded active running Security Auditing Service
avahi-daemon.service                   loaded active running Avahi mDNS/DNS-SD Stack
chronyd.service                        loaded active running NTP client/server
colord.service                         loaded active running Manage, Install and Generate Color Prof
crond.service                          loaded active running Command Scheduler
cups.service                           loaded active running CUPS Printing Service
.......

2)顯示服務開機啓動列表

[root@lee ~]# systemctl list-unit-files -t service 
UNIT FILE                                   STATE   
abrt-ccpp.service                           enabled 
abrt-oops.service                           enabled 
abrt-pstoreoops.service                     disabled
abrt-vmcore.service                         enabled 
abrt-xorg.service                           enabled 
abrtd.service                               enabled 
accounts-daemon.service                     enabled 
anaconda-direct.service                     static  
anaconda-nm-config.service                  static  
anaconda-noshell.service                    static  
.......

3)停止服務取消開機自啓動

[root@lee ~]# systemctl [狀態] [服務] 
[root@lee ~]# systemctl [選項] [服務]

[root@lee ~]# systemctl stop postfix.service 
[root@lee ~]# systemctl disable postfix

4)開機啓動

[root@lee ~]# systemctl enable postfix

5)查看 SysV 服務啓動狀態

[root@lee ~]# chkconfig --list

注意:該輸出結果只顯示 SysV 服務,並不包含原生 systemd 服務。SysV 配置數據可能被原生 systemd 配置覆蓋。 
      如果您想列出 systemd 服務,請執行 'systemctl list-unit-files'。
      欲查看對特定 target 啓用的服務請執行
      'systemctl list-dependencies [target]'。

netconsole      0:1:2:3:4:5:6:關
network         0:1:2:3:4:5:6:關
rhnsd           0:1:2:3:4:5:6:
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章