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

[root@bogon rsyslog.d]# systemctl is-enabled httpd
disabled
[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...age
Jun 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...age
Jun 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 -DFOREGROUND

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...age
Jun 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...age
Jun 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...age
Jun 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  httpd
Created 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  httpd
disabled
[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等。以后会补充进来

posted on   标配的小号  阅读(821)  评论(0编辑  收藏  举报

导航

< 2024年12月 >
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 1 2 3 4
5 6 7 8 9 10 11
点击右上角即可分享
微信分享提示