3-11·RHEL7&CentOS7服务命令

来源:互联网 发布:vb sleep函数 编辑:程序博客网 时间:2024/06/06 04:03

1)服务状态

1.检查服务器服务状态

[root@lee ~]# systemctl -t service UNIT                                   LOAD   ACTIVE SUB     DESCRIPTIONabrt-ccpp.service                      loaded active exited  Install ABRT coredump hookabrt-oops.service                      loaded active running ABRT kernel log watcherabrt-xorg.service                      loaded active running ABRT Xorg log watcherabrtd.service                          loaded active running ABRT Automated Bug Reporting Toolatd.service                            loaded active running Job spooling toolsauditd.service                         loaded active running Security Auditing Serviceavahi-daemon.service                   loaded active running Avahi mDNS/DNS-SD Stackchronyd.service                        loaded active running NTP client/servercolord.service                         loaded active running Manage, Install and Generate Color Profcrond.service                          loaded active running Command Schedulercups.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                     disabledabrt-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: