centos7查看服务开机启用和禁用的方法 - hsg77的专栏 - CSDN博客

centos7查看服务开机启用和禁用的方法

加入开机启动

systemctl enable mysqld;
systemctl enable firewalld.service ;
systemctl enable httpd.service;

先关闭,停止运行服务

systemctl stop firewalld.service ;

加入开机禁用

systemctl disable firewalld.service;

查看状态

systemctl status iptables.service;
systemctl status mysqld;

查看httpd的开机启动状态列表

systemctl list-unit-files;
UNIT FILE                              STATE   
proc-sys-fs-binfmt_misc.automount      static  
dev-hugepages.mount                    static  
dev-mqueue.mount                       static  
proc-sys-fs-binfmt_misc.mount          static  
sys-fs-fuse-connections.mount          static  
sys-kernel-config.mount                static  
sys-kernel-debug.mount                 static  
tmp.mount                              disabled
brandbot.path                          disabled
systemd-ask-password-console.path      static  
systemd-ask-password-plymouth.path     static  
systemd-ask-password-wall.path         static  
session-1.scope                        static  
session-2.scope                        static  
session-4.scope                        static  
arp-ethers.service                     disabled
auditd.service                         enabled 
autovt@.service                        enabled 
blk-availability.service               disabled
brandbot.service                       static  
chrony-dnssrv@.service                 static  
chrony-wait.service                    disabled
chronyd.service                        enabled 
console-getty.service                  disabled
console-shell.service                  disabled
container-getty@.service               static  
cpupower.service                       disabled
crond.service                          enabled 
dbus-org.freedesktop.hostname1.service static  
dbus-org.freedesktop.import1.service   static  
dbus-org.freedesktop.locale1.service   static  
dbus-org.freedesktop.login1.service    static  
dbus-org.freedesktop.machine1.service  static  
dbus-org.freedesktop.network1.service  bad     
dbus-org.freedesktop.timedate1.service static  
dbus.service                           static  
debug-shell.service                    disabled
dm-event.service                       disabled
dnsmasq.service                        disabled
dracut-cmdline.service                 static  
dracut-initqueue.service               static  
dracut-mount.service                   static  
dracut-pre-mount.service               static  
dracut-pre-pivot.service               static  
dracut-pre-trigger.service             static  
dracut-pre-udev.service                static  
dracut-shutdown.service                static  
ebtables.service                       disabled
emergency.service                      static  
firewalld.service                      disabled
fstrim.service                         static  
lines 1-52

UNIT FILE                              STATE   
proc-sys-fs-binfmt_misc.automount      static  
dev-hugepages.mount                    static  
dev-mqueue.mount                       static  
proc-sys-fs-binfmt_misc.mount          static  
sys-fs-fuse-connections.mount          static  
sys-kernel-config.mount                static  
sys-kernel-debug.mount                 static  
tmp.mount                              disabled
brandbot.path                          disabled
systemd-ask-password-console.path      static  
systemd-ask-password-plymouth.path     static  
systemd-ask-password-wall.path         static  
session-1.scope                        static  
session-2.scope                        static  
session-4.scope                        static  
arp-ethers.service                     disabled
auditd.service                         enabled 
autovt@.service                        enabled 
blk-availability.service               disabled
brandbot.service                       static  
chrony-dnssrv@.service                 static  
chrony-wait.service                    disabled
chronyd.service                        enabled 
console-getty.service                  disabled
console-shell.service                  disabled
container-getty@.service               static  
lines 1-27

UNIT FILE                              STATE   
proc-sys-fs-binfmt_misc.automount      static  
dev-hugepages.mount                    static  
dev-mqueue.mount                       static  
proc-sys-fs-binfmt_misc.mount          static  
sys-fs-fuse-connections.mount          static  
sys-kernel-config.mount                static  
sys-kernel-debug.mount                 static  
tmp.mount                              disabled
brandbot.path                          disabled
systemd-ask-password-console.path      static  
systemd-ask-password-plymouth.path     static  
systemd-ask-password-wall.path         static  
session-1.scope                        static  
session-2.scope                        static  
session-4.scope                        static  
arp-ethers.service                     disabled
auditd.service                         enabled 
autovt@.service                        enabled 
blk-availability.service               disabled
brandbot.service                       static  
chrony-dnssrv@.service                 static  
chrony-wait.service                    disabled
chronyd.service                        enabled 
console-getty.service                  disabled
console-shell.service                  disabled
container-getty@.service               static  
cpupower.service                       disabled
crond.service                          enabled 
dbus-org.freedesktop.hostname1.service static  
dbus-org.freedesktop.import1.service   static  
dbus-org.freedesktop.locale1.service   static  
dbus-org.freedesktop.login1.service    static  
dbus-org.freedesktop.machine1.service  static  
dbus-org.freedesktop.network1.service  bad     
dbus-org.freedesktop.timedate1.service static  
dbus.service                           static  
debug-shell.service                    disabled
dm-event.service                       disabled
dnsmasq.service                        disabled
dracut-cmdline.service                 static  
dracut-initqueue.service               static  
dracut-mount.service                   static  
dracut-pre-mount.service               static  
dracut-pre-pivot.service               static  
dracut-pre-trigger.service             static  
dracut-pre-udev.service                static  
dracut-shutdown.service                static  
ebtables.service                       disabled
emergency.service                      static  
firewalld.service                      disabled
fstrim.service                         static  
getty@.service                         enabled 
halt-local.service                     static  
initrd-cleanup.service                 static  
initrd-parse-etc.service               static  
initrd-switch-root.service             static  
initrd-udevadm-cleanup-db.service      static  
iprdump.service                        disabled
iprinit.service                        disabled
iprupdate.service                      disabled
irqbalance.service                     enabled 
kdump.service                          enabled 
kmod-static-nodes.service              static  
lvm2-lvmetad.service                   disabled
lvm2-lvmpolld.service                  disabled
lvm2-monitor.service                   enabled 
lvm2-pvscan@.service                   static  
messagebus.service                     static  
microcode.service                      enabled 
mysql.service                          enabled 
mysqld.service                         enabled 
NetworkManager-dispatcher.service      disabled
NetworkManager-wait-online.service     enabled 
NetworkManager.service                 disabled
plymouth-halt.service                  disabled
plymouth-kexec.service                 disabled
plymouth-poweroff.service              disabled
plymouth-quit-wait.service             disabled
plymouth-quit.service                  disabled
plymouth-read-write.service            disabled
plymouth-reboot.service                disabled
plymouth-start.service                 disabled
plymouth-switch-root.service           static  
polkit.service                         static  
postfix.service                        enabled 
postgresql-10.service                  enabled 
quotaon.service                        static  
rc-local.service                       static  
rdisc.service                          disabled
rdma.service                           disabled
rescue.service                         static  
rhel-autorelabel-mark.service          static  
rhel-autorelabel.service               static  
rhel-configure.service                 static  
rhel-dmesg.service                     disabled
rhel-domainname.service                disabled
rhel-import-state.service              static  
rhel-loadmodules.service               static  
rhel-readonly.service                  static  
rsyslog.service                        enabled 
serial-getty@.service                  disabled
sshd-keygen.service                    static  
sshd.service                           enabled 
sshd@.service                          static  
systemd-ask-password-console.service   static  
systemd-ask-password-plymouth.service  static  
systemd-ask-password-wall.service      static  
systemd-backlight@.service             static  
systemd-binfmt.service                 static  
systemd-bootchart.service              disabled
systemd-firstboot.service              static  
systemd-fsck-root.service              static  
systemd-fsck@.service                  static  
systemd-halt.service                   static  
systemd-hibernate-resume@.service      static  
systemd-hibernate.service              static  
systemd-hostnamed.service              static  
systemd-hwdb-update.service            static  
systemd-hybrid-sleep.service           static  
systemd-importd.service                static  
systemd-initctl.service                static  
systemd-journal-catalog-update.service static  
systemd-journal-flush.service          static  
systemd-journald.service               static  
systemd-kexec.service                  static  
systemd-localed.service                static  
systemd-logind.service                 static  
systemd-machine-id-commit.service      static  
systemd-machined.service               static  
systemd-modules-load.service           static  
systemd-nspawn@.service                disabled
systemd-poweroff.service               static  
systemd-quotacheck.service             static  
systemd-random-seed.service            static  
systemd-readahead-collect.service      enabled 
systemd-readahead-done.service         indirect
systemd-readahead-drop.service         enabled 
systemd-readahead-replay.service       enabled 
systemd-reboot.service                 static  
systemd-remount-fs.service             static  
systemd-rfkill@.service                static  
systemd-shutdownd.service              static  
systemd-suspend.service                static  
systemd-sysctl.service                 static  
systemd-timedated.service              static  
systemd-tmpfiles-clean.service         static  
systemd-tmpfiles-setup-dev.service     static  
systemd-tmpfiles-setup.service         static  
systemd-udev-settle.service            static  
systemd-udev-trigger.service           static  
systemd-udevd.service                  static  
systemd-update-done.service            static  
systemd-update-utmp-runlevel.service   static  
systemd-update-utmp.service            static  
systemd-user-sessions.service          static  
systemd-vconsole-setup.service         static  
tcsd.service                           disabled
teamd@.service                         static  
tomcat.service                         enabled 
tomcat@.service                        disabled
tuned.service                          enabled 
wpa_supplicant.service                 disabled
-.slice                                static  
machine.slice                          static  
system.slice                           static  
user.slice                             static  
dbus.socket                            static  
dm-event.socket                        enabled 
lvm2-lvmetad.socket                    enabled 
lvm2-lvmpolld.socket                   enabled 
sshd.socket                            disabled
syslog.socket                          static  
systemd-initctl.socket                 static  
systemd-journald.socket                static  
systemd-networkd.socket                disabled
systemd-shutdownd.socket               static  
systemd-udevd-control.socket           static  
systemd-udevd-kernel.socket            static  
basic.target                           static  
bluetooth.target                       static  
cryptsetup-pre.target                  static  
cryptsetup.target                      static  
ctrl-alt-del.target                    disabled
default.target                         enabled 
emergency.target                       static  
final.target                           static  
getty.target                           static  
graphical.target                       static  
halt.target                            disabled
hibernate.target                       static  
hybrid-sleep.target                    static  
initrd-fs.target                       static  
initrd-root-fs.target                  static  
halt-local.service                     static  
initrd-cleanup.service                 static  
initrd-parse-etc.service               static  
initrd-switch-root.service             static  
initrd-udevadm-cleanup-db.service      static  
iprdump.service                        disabled
iprinit.service                        disabled
iprupdate.service                      disabled
irqbalance.service                     enabled 
kdump.service                          enabled 
kmod-static-nodes.service              static  
lvm2-lvmetad.service                   disabled
lvm2-lvmpolld.service                  disabled
lvm2-monitor.service                   enabled 
lvm2-pvscan@.service                   static  
messagebus.service                     static  
microcode.service                      enabled 
mysql.service                          enabled 
mysqld.service                         enabled 
NetworkManager-dispatcher.service      disabled
NetworkManager-wait-online.service     enabled 
NetworkManager.service                 disabled
plymouth-halt.service                  disabled
plymouth-kexec.service                 disabled
plymouth-poweroff.service              disabled
plymouth-quit-wait.service             disabled
plymouth-quit.service                  disabled
plymouth-read-write.service            disabled
plymouth-reboot.service                disabled
plymouth-start.service                 disabled
plymouth-switch-root.service           static  
polkit.service                         static  
postfix.service                        enabled 
postgresql-10.service                  enabled 
quotaon.service                        static  
rc-local.service                       static  
rdisc.service                          disabled
rdma.service                           disabled
rescue.service                         static  
rhel-autorelabel-mark.service          static  
rhel-autorelabel.service               static  
rhel-configure.service                 static  
rhel-dmesg.service                     disabled
rhel-domainname.service                disabled
rhel-import-state.service              static  
rhel-loadmodules.service               static  
rhel-readonly.service                  static  
rsyslog.service                        enabled 

原网址: 访问
创建于: 2018-10-15 19:24:17
目录: default
标签: 无

请先后发表评论
  • 最新评论
  • 总共0条评论