Functional BytesFunctional Bytes

Linux Service Managers and Init Systems


Rough Notes

  • systemd is for both system init and service management
  • supervisord is only for service managment

Commands

  • The service command is a "wrapper"/"high-level" command that will call the respective "low-level" manager such as systemctl
  • The service command allows for basic interatctions such as status, start, reload, etc.
  • The systemctl command allows for advanced commands such as checking if a service is enabled (activated when booting): systemctl is-enabled sshd.service

Quick Reference

  • Enable service to run at startup
    sudo systemctl enable sshd.service
    
  • Disable service from running at startup
    sudo systemctl disable sshd.service
    

Init Systems

  • Init systems are those that run in process #1 - responsible for bootstrapping the system
  • May also be responsible for starting and managing services (long running, background process)
  • Ubuntu used to use upstart but switched to systemd in version 15.04 (2015)
  • Alpine linux uses OpenRC
  • systemd is linux specific - (BSD distros such as FreeBSD have their own "BSD-style init")
  • Although highly adopted, there is a lot of contreversy around systemd (see: [Reddit] ELI5: The SystemD vs. init/upstart controversy)

Service Managers

Outside of init systems, there are also dedicated service managers such as Supervisor (supervisord)

It shares some of the same goals of programs like launchd, daemontools, and runit. Unlike some of these programs, it is not meant to be run as a substitute for init as “process id 1”. Instead it is meant to be used to control processes related to a project or a customer, and is meant to start like any other program at boot time.

[supervisord.org] Supervisor: A Process Control System

  • Advantages of using something like supervisord are that it is OS agnostic and since it is outside of process #1, processes can be managed by users other than root/sudo

Important Reading

References