Centos7禁止或者允许开机启动服务

来源:互联网 发布:淘宝页尾 编辑:程序博客网 时间:2024/06/04 19:05
[root@bogon rsyslog.d]# systemctl is-enabled httpddisabled[root@bogon rsyslog.d]# systemctl status  httpd● httpd.service - The Apache HTTP Server   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)   Active: inactive (dead)     Docs: man:httpd(8)           man:apachectl(8)Jun 26 04:51:42 bogon systemd[1]: httpd.service failed.Jun 26 04:53:28 bogon systemd[1]: Starting The Apache HTTP Server...Jun 26 04:53:29 bogon httpd[9652]: AH00558: httpd: Could not reliably determine the...ageJun 26 04:53:29 bogon systemd[1]: Started The Apache HTTP Server.Jun 26 05:38:31 bogon systemd[1]: Stopping The Apache HTTP Server...Jun 26 05:38:32 bogon systemd[1]: Starting The Apache HTTP Server...Jun 26 05:38:33 bogon httpd[12171]: AH00558: httpd: Could not reliably determine th...ageJun 26 05:38:33 bogon systemd[1]: Started The Apache HTTP Server.Jun 26 06:20:03 bogon systemd[1]: Stopping The Apache HTTP Server...Jun 26 06:20:04 bogon systemd[1]: Stopped The Apache HTTP Server.Hint: Some lines were ellipsized, use -l to show in full.[root@bogon rsyslog.d]# systemctl start  httpd              #开启自启动[root@bogon rsyslog.d]# systemctl status  httpd             #查看服务当前状态● httpd.service - The Apache HTTP Server   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)   Active: active (running) since Mon 2017-06-26 07:56:27 PDT; 4s ago     Docs: man:httpd(8)           man:apachectl(8) Main PID: 15508 (httpd)   Status: "Processing requests..."   CGroup: /system.slice/httpd.service           ├─15508 /usr/sbin/httpd -DFOREGROUND           ├─15509 /usr/sbin/httpd -DFOREGROUND           ├─15510 /usr/sbin/httpd -DFOREGROUND           ├─15511 /usr/sbin/httpd -DFOREGROUND           ├─15512 /usr/sbin/httpd -DFOREGROUND           └─15513 /usr/sbin/httpd -DFOREGROUNDJun 26 07:56:25 bogon systemd[1]: Starting The Apache HTTP Server...Jun 26 07:56:26 bogon httpd[15508]: AH00558: httpd: Could not reliably determine th...ageJun 26 07:56:27 bogon systemd[1]: Started The Apache HTTP Server.Hint: Some lines were ellipsized, use -l to show in full.[root@bogon rsyslog.d]# systemctl stop  httpd               #禁止自启动[root@bogon rsyslog.d]# systemctl status  httpd● httpd.service - The Apache HTTP Server   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)   Active: inactive (dead)     Docs: man:httpd(8)           man:apachectl(8)Jun 26 05:38:32 bogon systemd[1]: Starting The Apache HTTP Server...Jun 26 05:38:33 bogon httpd[12171]: AH00558: httpd: Could not reliably determine th...ageJun 26 05:38:33 bogon systemd[1]: Started The Apache HTTP Server.Jun 26 06:20:03 bogon systemd[1]: Stopping The Apache HTTP Server...Jun 26 06:20:04 bogon systemd[1]: Stopped The Apache HTTP Server.Jun 26 07:56:25 bogon systemd[1]: Starting The Apache HTTP Server...Jun 26 07:56:26 bogon httpd[15508]: AH00558: httpd: Could not reliably determine th...ageJun 26 07:56:27 bogon systemd[1]: Started The Apache HTTP Server.Jun 26 07:56:35 bogon systemd[1]: Stopping The Apache HTTP Server...Jun 26 07:56:36 bogon systemd[1]: Stopped The Apache HTTP Server.Hint: Some lines were ellipsized, use -l to show in full.[root@bogon rsyslog.d]# systemctl start  httpd[root@bogon rsyslog.d]# systemctl restart  httpd[root@bogon rsyslog.d]# systemctl enable  httpdCreated symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.[root@bogon rsyslog.d]# systemctl is-enabled  httpd         #查询是否自启动enabled[root@bogon rsyslog.d]# systemctl disable  httpd            #禁止自启动Removed symlink /etc/systemd/system/multi-user.target.wants/httpd.service.[root@bogon rsyslog.d]# systemctl is-enabled  httpddisabled[root@bogon rsyslog.d]# systemctl list-unit-files|grep enabled      #查看自启动服务列表abrt-ccpp.service                           enabled abrt-oops.service                           enabled abrt-vmcore.service                         enabled abrt-xorg.service                           enabled abrtd.service                               enabled accounts-daemon.service                     enabled atd.service                                 enabled auditd.service                              enabled autovt@.service                             enabled avahi-daemon.service                        enabled chronyd.service                             enabled crond.service                               enabled dbus-org.fedoraproject.FirewallD1.service   enabled dbus-org.freedesktop.Avahi.service          enabled dbus-org.freedesktop.ModemManager1.service  enabled dbus-org.freedesktop.NetworkManager.service enabled dbus-org.freedesktop.nm-dispatcher.service  enabled display-manager.service                     enabled dmraid-activation.service                   enabled firewalld.service                           enabled gdm.service                                 enabled getty@.service                              enabled irqbalance.service                          enabled iscsi.service                               enabled kdump.service                               enabled ksm.service                                 enabled ksmtuned.service                            enabled libstoragemgmt.service                      enabled libvirtd.service                            enabled lvm2-monitor.service                        enabled mdmonitor.service                           enabled microcode.service                           enabled ModemManager.service                        enabled multipathd.service                          enabled NetworkManager-dispatcher.service           enabled NetworkManager.service                      enabled postfix.service                             enabled qemu-guest-agent.service                    enabled rngd.service                                enabled rsyslog.service                             enabled rtkit-daemon.service                        enabled smartd.service                              enabled spice-vdagentd.service                      enabled sshd.service                                enabled sysstat.service                             enabled systemd-readahead-collect.service           enabled systemd-readahead-drop.service              enabled systemd-readahead-replay.service            enabled tuned.service                               enabled vmtoolsd.service                            enabled xinetd.service                              enabled avahi-daemon.socket                         enabled dm-event.socket                             enabled iscsid.socket                               enabled iscsiuio.socket                             enabled lvm2-lvmetad.socket                         enabled lvm2-lvmpolld.socket                        enabled rpcbind.socket                              enabled virtlockd.socket                            enabled virtlogd.socket                             enabled default.target                              enabled graphical.target                            enabled nfs-client.target                           enabled remote-fs.target                            enabled runlevel5.target                            enabled [root@bogon rsyslog.d]# 

还有基于运行级别上的设置,例如在图形模式下启动httpd,但是在命令行模式下禁止自启httpd等。以后会补充进来