Advantages of Systemd vs. SysVinit, Example Commands

Advantages of Systemd vs. SysVinit, Example Commands

(This post applies to CentOS 7, RHEL 7, Fedora 21+, and recent Debian and Ubuntu-based distributions.)

The experienced System Administrator will know SysVinit and the perennial init commands used to control system run levels, for example, 'init 6' to reboot.

As of 2014, however, most Linux distributions now rely on the newer Systemd system and service manager. While the init commands can still be used there are some notable advantages that Systemd offers. Below are a few such advantages.

  1. Systemd daemons make it is easier to supervise and control processes and parallelized job execution.
  2. Systemd offers the systemctl command and cgroups to make your life easier:
  3. systemctl provides the administrator with more detailed error messages including runtime and start-up errors.
  4. cgroups, or "control groups", allow for the grouping of processes into a hierarchy for easier management.
  5. Process attributes such as function and ownership are much easier to ascertain. For example, under Systemd, sub-processes, once spawned, become 'children' and are organized under the appropriate 'parent' group to show inheritance.

To see an example of the clear visual hierarchy and process management under Systemd, try the pstree command.

On my CentOS 7 system it looks like this:



Here are some useful Systemd commands for your reference...

Controlling Runlevels:

1. systemctl poweroff --> shut down (runlevel 0)
2. systemctl rescue.target --> enter rescue mode (runlevel 1, single-user)
3. systemctl multi-user.target --> enter multi-user mode (runlevels 2 through 4)
4. systemctl graphical.target --> enter graphical mode (runlevel 5)
5. systemctl reboot --> reboot the system (runlevel 6)

Controlling Services:

1. systemctl start dummy.service --> start the "dummy" service
2. systemctl stop dummy.service --> stop the "dummy" service
3. systemctl restart dummy.service --> restart the "dummy" service
4. systemctl status dummy.service --> get status of "dummy" service
5. systemctl kill dummy --> kill all processes related to "dummy" service

Other Useful Commands:

1. journalctl -f --> follow the system logs (i.e. 'tail -f /var/log/messages')
2. journalctl --since=today --> get logs of all events that have occurred today
3. hostnamectl --> get system hostname and other host information
4. timedatectl --> get system date, time, and timezone information


There are many more examples of commands available, as well as a beautiful PDF you can download, on Linoxide's write-up here: linoxide.com/linux-command/systemd-vs-sysvinit-cheatsheet

Source: http://linoxide.com/linux-command/systemd-vs-sysvinit-cheatsheet/

    • Related Articles

    • Supermicro Update Manager (SUM)

      Introduction The Supermicro Update Manager (SUM) can be used to manage the BIOS and BMC firmware image update and configuration update for select systems. In addition, system checks as well as event log management are also supported. Moreover, ...
    • Install the Latest Stable Kernel on CentOS 6/7

      Source: http://www.makeuseof.com/tag/update-linux-kernel-improved-system-performance/ CHECK LATER: http://www.makeuseof.com/tag/5-reasons-update-kernel-linux/   --- DRAFT 8/30/16 - Adam Why update to latest stable kernel? Performance improvements new ...
    • Updating MAC Addresses (CentOS/RHEL)

      If your system's motherboard has recently been replaced, you may encounter network failures due to the new motherboard using different MAC addresses. Modern Linux distributions such as CentOS and Red Hat will typically auto-populate udev rules and ...
    • BBU Commands for Storcli

      *****Recent Versions of Storcli now use the /cv command**** storcli /cx /cv Example.. storcli /c0 /cv BBU Commands The Storage Command Line Tool supports the following battery backup unit (BBU) commands: storcli /cx/bbu show storcli /cx/bbu show all ...
    • Fan alerts in MegaRAID Storage Manager

      Q: My RAID controller is reporting fan failures, but the system appears to be functioning just fine. Why is this happening? A: The RAID controller is reading those statuses from the backplane. This is normal behavior if you have recently installed a ...