User Tools

Site Tools


eduardo:linux:systemd

Systemd

One of the major changes in RHEL / CentOS 7.0 is the swtich to systemd, a system and service manager, that replaces SysV and Upstart used in previous releases of Red Hat Enterprise Linux. systemd is compatible with SysV and Linux Standard Base init scripts.

Systemd is a system and service manager for Linux operating systems. It is designed to be backwards compatible with SysV init scripts, and provides a number of features such as parallel startup of system services at boot time, on-demand activation of daemons, support for system state snapshots, or dependency-based service control logic.

Previous versions of Red Hat Enterprise Linux, which were distributed with SysV init or Upstart, used init scripts written in bash located in the /etc/rc.d/init.d/ directory. In RHEL 7 / CentOS 7, these init scripts have been replaced with service units. Service units end with the .service file extension and serve a similar purpose as init scripts. To view, start, stop, restart, enable, or disable system services you will use the systemctl instead of the old service command. Note: for backwards compatibility the old service command is still available in CentOS 7 and it will redirect any command to the new systemctl utility.

SysVinit to Systemd Cheatsheet

Sysvinit Command Systemd Command Notes
service frobozz start systemctl start frobozz Used to start a service (not reboot persistent)
service frobozz stop systemctl stop frobozz Used to stop a service (not reboot persistent)
service frobozz restart systemctl restart frobozz Used to stop and then start a service
service frobozz reload systemctl reload frobozz When supported, reloads the config file without interrupting pending operations.
service frobozz condrestart systemctl condrestart frobozz Restarts if the service is already running.
service frobozz status systemctl status frobozz Tells whether a service is currently running.
ls /etc/rc.d/init.d/ systemctl (or) systemctl list-unit-files –type=service (or)
ls /lib/systemd/system/*.service /etc/systemd/system/*.service
Used to list the services that can be started or stopped
Used to list all the services and other units
chkconfig frobozz on systemctl enable frobozz Turn the service on, for start at next boot, or other trigger.
chkconfig frobozz off systemctl disable frobozz Turn the service off for the next reboot, or any other trigger.
chkconfig frobozz systemctl is-enabled frobozz Used to check whether a service is configured to start or not in the current environment.
chkconfig –list systemctl list-unit-files –type=service (or) ls /etc/systemd/system/*.wants/ Print a table of services that lists which runlevels each is configured on or off
chkconfig –list | grep 5:on systemctl list-dependencies graphical.target Print a table of services that will be started when booting into graphical mode
chkconfig frobozz –list ls /etc/systemd/system/*.wants/frobozz.service Used to list what levels this service is configured on or off
chkconfig frobozz –add systemctl daemon-reload Used when you create a new service file or modify any configuration
eduardo/linux/systemd.txt · Last modified: 2024/02/23 08:20 by 127.0.0.1