SysVinit Vs Systemd Cheatsheet
systemd is a new init system and system manager which was implemented/adapted into all the major Linux distributions over the traditional SysV init systems.
systemd is compatible with SysV and LSB init scripts.
It can work as a drop-in replacement for sysvinit system.
systemd is the first process get started by kernel and holding PID 1.
It’s a parent process for everything and Fedora 15 is the first distribution which was adapted systemd instead of upstart.
systemctl is command line utility and primary tool to manage the systemd daemons/services such as (start, restart, stop, enable, disable, reload & status).
.service files Instead of bash scripts (SysVinit uses). systemd sorts all daemons into their own Linux cgroups and you can see the system hierarchy by exploring
Below three init systems are widely used in Linux.
System V (Sys V):System V (Sys V) is one of the first and traditional init system for Unix like operating system.
Upstart:Upstart is an event-based replacement for the /sbin/init daemon.
systemd:Systemd is a new init system and system manager which was implemented/adapted into all the major Linux distributions over the traditional SysV init systems.
What is System V (Sys V)?
System V (Sys V) is one of the first and traditional init system for Unix like operating system. init is the first process that started during the system boot up by the kernel and it’s a parent process for everything.
Most of the Linux distributions started using traditional init system called System V (Sys V) first. Over the years, several replacement init systems were released to address design limitations in the standard versions such as launchd, the Service Management Facility, systemd and Upstart.
But systemd has been adopted by several major Linux distributions over the traditional SysV init systems.
What is systemd?
systemd is a new init system and system manager which is become very popular and widely adapted new standard init system by most of Linux distributions. Systemctl is a systemd utility which is help us to manage systemd system.
- Systemd provides aggressive parallelization capabilities
- Uses socket and D-Bus activation for starting services
- Offers on-demand starting of daemons
- Keeps track of processes using Linux cgroups
- Supports snapshotting and restoring of the system state
- Maintains mount and automount points
- Implements an elaborate transactional dependency-based service control logic
|Start a Service||service example start||systemctl start example|
|Stop a Service||service example stop||systemctl stop example|
|Stop and then Start a Service (Restart a Service)||service example restart||systemctl restart example|
|Reload a Service (Reload the config file)||service example reload||systemctl reload example|
|Restarts if the service is already running||service example restart||systemctl restart example|
|Check whether a service is currently running||service example status||systemctl status example|
|Enable the service in boot||chkconfig example on||systemctl enable example|
|Disable the service in boot||chkconfig example off||systemctl disable example|
|check whether a service is configured to start or not in boot||chkconfig example||systemctl is-enabled example|
|Print a list of services enabled or disabled on boot with runlevels info||chkconfig --list||systemctl list-unit-files --type=service|
|Paint a particular service info with runlevlels on or off||chkconfig example --list||ls /etc/systemd/system/*.wants/example.service|
|Create a new service file or modify any configuration||chkconfig example --add||systemctl daemon-reload|
Runlevels/targets : Systemd has a concept of targets which serve a similar purpose as runlevels but act a little different. Each target is named instead of numbered and is intended to serve a specific purpose.
|Halt the system||0, halt||runlevel0.target, poweroff.target, systemctl halt|
|Single user mode||1, S, single||runlevel1.target, rescue.target|
|Multi User||2||runlevel2.target, multi-user.target|
|Multi User with Network||3||runlevel3.target, multi-user.target|
|Experimental (No User)||4||runlevel4.target, multi-user.target|
|Multi-user With Graphical & Network||5||runlevel5.target, graphical.target|
|Reboot||6, reboot||runlevel6.target, reboot.target, systemctl reboot|