Before CentOS 7 and RHEL 7, System V was used to be the system controller.
The system controller can manage all processes, services, and start task.
System V has a performance problem as it is using script to manage the tasks.
So it can only start the task serially, which will slow down the startup of the
From CentOS 7, the systemd become the new system controller. The biggest
change is it can start task parallel and will improve the startup speed. And as
the its PID is 1, the systemd is controlling every process in the system!
This article will only shows the information of “service”, “start up task”, and “log manage” by systemd.
systemctl list-unit-files --type=service
PageDown to go up and down, type
q to quit.
systemctl list-units --type=service
If there is a big point ● in front of a service, it means this service has some
systemctl list-unit-files --type=service | grep enabled
systemctl status <name of service>
The output will contain the status of activity, PID, path of the service, and
the latest 10 logs.
systemctl status rsyslog
systemctl list-units --type=service --state=failed
systemd-analyze blame | grep .service
systemctl start <service name>
systemctl stop <service name>
systemctl restart <service name>
systemctl reload <service name>
If the service can’t be restart but need to change the settings, reload is a
systemctl enable <service name>
systemctl disable <service name>
Mask a service to make it can’t be started by other service nor
systemctl mask <service name>
Unmask a service which has already been masked.
systemctl unmask <service name>
Do this when you add/remove service units.
When can create a unit file an put it into
daemon-reload after create a new service unit file.
systemctl set-default <target name>
systemctl isolate <target name>
journalctl -e -f
journalctl -e -f -u <unit name>
journalctl --since="yyyy-MM-dd hh:mm:ss" --until="yyyy-MM-dd hh:mm:ss"
/etc/systemd/journald.conf, and set value
to this parameter.
After this, restart journald service
systemctl restart systemd-journald.service
- CentOS 7 Systemd 入门 ，作者: 余泽楠 https://zhuanlan.zhihu.com/p/29217941