格式:systemctl [OPTIONS…] COMMAND [NAME…]
服务相关:
systemctl status name.service:查看服务状态
systemctl start name.service:启动服务
systemctl stop name.service:停止服务
systemctl restart name.service:重启服务
systemctl list-units –type service –all:查看所有服务
服务相关:
systemctl status name.service:查看服务状态
systemctl start name.service:启动服务
systemctl stop name.service:停止服务
systemctl restart name.service:重启服务
systemctl list-units –type service –all:查看所有服务
systemctl status name.service:查看服务状态
[root@localhost ~]# systemctl status network.service ● network.service - LSB: Bring up/down networking Loaded: loaded (/etc/rc.d/init.d/network) Active: active (exited) since Thu 2017-11-09 14:27:56 CST; 2 months 7 days ago Docs: man:systemd-sysv-generator(8) Process: 1095 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS) Nov 09 14:27:55 localhost.localdomain systemd[1]: Starting LSB: Bring up/down networking... Nov 09 14:27:56 localhost.localdomain network[1095]: Bringing up loopback interface: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo' Nov 09 14:27:56 localhost.localdomain network[1095]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo' Nov 09 14:27:56 localhost.localdomain network[1095]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo' Nov 09 14:27:56 localhost.localdomain network[1095]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo' Nov 09 14:27:56 localhost.localdomain network[1095]: [ OK ] Nov 09 14:27:56 localhost.localdomain network[1095]: Bringing up interface eno16777984: [ OK ] Nov 09 14:27:56 localhost.localdomain systemd[1]: Started LSB: Bring up/down networking.
systemctl start name.service:启动服务
systemctl stop name.service:停止服务
systemctl restart name.service:重启服务
systemctl list-units –type service –all:查看所有服务
[root@localhost ~]# systemctl list-units --type service --all 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-vmcore.service loaded inactive dead Harvest vmcores for ABRT abrt-xorg.service loaded inactive dead ABRT Xorg log watcher abrtd.service loaded active running ABRT Automated Bug Reporting Tool auditd.service loaded active running Security Auditing Service brandbot.service loaded inactive dead Flexible Branding Service chronyd.service loaded active running NTP client/server cpupower.service loaded inactive dead Configure CPU power related settings crond.service loaded active running Command Scheduler dbus.service loaded active running D-Bus System Message Bus ● display-manager.service not-found inactive dead display-manager.service dracut-shutdown.service loaded inactive dead Restore /run/initramfs ebtables.service loaded inactive dead Ethernet Bridge Filtering tables emergency.service loaded inactive dead Emergency Shell ● exim.service not-found inactive dead exim.service firewalld.service loaded active running firewalld - dynamic firewall daemon getty@tty1.service loaded active running Getty on tty1 ● ip6tables.service not-found inactive dead ip6tables.service ● iptables.service not-found inactive dead iptables.service irqbalance.service loaded active running irqbalance daemon kdump.service loaded active exited Crash recovery kernel arming kmod-static-nodes.service loaded active exited Create list of required static device nodes for the current kernel ldconfig.service loaded inactive dead Rebuild Dynamic Linker Cache ● libvirtd.service not-found inactive dead libvirtd.service ● livesys.service not-found inactive dead livesys.service microcode.service loaded inactive dead Load CPU microcode update network.service loaded active exited LSB: Bring up/down networking NetworkManager-wait-online.service loaded inactive dead Network Manager Wait Online NetworkManager.service loaded active running Network Manager ● ntpd.service not-found inactive dead ntpd.service ● ntpdate.service not-found inactive dead ntpdate.service plymouth-quit-wait.service loaded inactive dead Wait for Plymouth Boot Screen to Quit plymouth-quit.service loaded inactive dead Terminate Plymouth Boot Screen plymouth-read-write.service loaded inactive dead Tell Plymouth To Write Out Runtime Data plymouth-start.service loaded inactive dead Show Plymouth Boot Screen polkit.service loaded active running Authorization Manager postfix.service loaded active running Postfix Mail Transport Agent rc-local.service loaded inactive dead /etc/rc.d/rc.local Compatibility rescue.service loaded inactive dead Rescue Shell rhel-autorelabel-mark.service loaded inactive dead Mark the need to relabel after reboot rhel-autorelabel.service loaded inactive dead Relabel all filesystems, if necessary rhel-configure.service loaded inactive dead Reconfigure the system on administrator request rhel-dmesg.service loaded active exited Dump dmesg to /var/log/dmesg rhel-import-state.service loaded active exited Import network configuration from initramfs rhel-loadmodules.service loaded inactive dead Load legacy module configuration rhel-readonly.service loaded active exited Configure read-only root support rsyslog.service loaded active running System Logging Service ● sendmail.service not-found inactive dead sendmail.service ● sntp.service not-found inactive dead sntp.service sshd-keygen.service loaded inactive dead OpenSSH Server Key Generation sshd.service loaded active running OpenSSH server daemon ● syslog.service not-found inactive dead syslog.service systemd-ask-password-console.service loaded inactive dead Dispatch Password Requests to Console systemd-ask-password-plymouth.service loaded inactive dead Forward Password Requests to Plymouth systemd-ask-password-wall.service loaded inactive dead Forward Password Requests to Wall systemd-binfmt.service loaded inactive dead Set Up Additional Binary Formats systemd-firstboot.service loaded inactive dead First Boot Wizard systemd-fsck-root.service loaded inactive dead File System Check on Root Device systemd-hwdb-update.service loaded inactive dead Rebuild Hardware Database systemd-initctl.service loaded inactive dead /dev/initctl Compatibility Daemon systemd-journal-catalog-update.service loaded inactive dead Rebuild Journal Catalog systemd-journal-flush.service loaded active exited Flush Journal to Persistent Storage systemd-journald.service loaded active running Journal Service systemd-logind.service loaded active running Login Service systemd-machine-id-commit.service loaded inactive dead Commit a transient machine-id on disk systemd-modules-load.service loaded inactive dead Load Kernel Modules ● systemd-random-seed-load.service not-found inactive dead systemd-random-seed-load.service systemd-random-seed.service loaded active exited Load/Save Random Seed systemd-readahead-collect.service loaded inactive dead Collect Read-Ahead Data systemd-readahead-done.service loaded inactive dead Stop Read-Ahead Data Collection systemd-readahead-replay.service loaded inactive dead Replay Read-Ahead Data systemd-reboot.service loaded inactive dead Reboot systemd-remount-fs.service loaded active exited Remount Root and Kernel File Systems systemd-shutdownd.service loaded inactive dead Delayed Shutdown Service systemd-sysctl.service loaded active exited Apply Kernel Variables ● systemd-sysusers.service not-found inactive dead systemd-sysusers.service systemd-tmpfiles-clean.service loaded inactive dead Cleanup of Temporary Directories systemd-tmpfiles-setup-dev.service loaded active exited Create Static Device Nodes in /dev systemd-tmpfiles-setup.service loaded active exited Create Volatile Files and Directories systemd-udev-trigger.service loaded active exited udev Coldplug all Devices systemd-udevd.service loaded active running udev Kernel Device Manager systemd-update-done.service loaded inactive dead Update is Completed systemd-update-utmp-runlevel.service loaded inactive dead Update UTMP about System Runlevel Changes systemd-update-utmp.service loaded active exited Update UTMP about System Boot/Shutdown systemd-user-sessions.service loaded active exited Permit User Sessions systemd-vconsole-setup.service loaded active exited Setup Virtual Console tuned.service loaded active running Dynamic System Tuning Daemon wpa_supplicant.service loaded active running WPA Supplicant daemon LOAD = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB. SUB = The low-level unit activation state, values depend on unit type. 89 loaded units listed. To show all installed unit files use 'systemctl list-unit-files'.