systemd – Manage services in linux

What is systemd?

The “System Daemon” (short systemd) is a program, which has many tasks but the main tasks are initialising and manging services like the SSH-Daemon (sshd) or a webserver like NGINX.

Why do I need the systemd?

Just like on your desktop not all programs are running at the same time its the same on a server.

With the systemd you configure which programs should be automatically started when you start/reboot your server. But also you have other commands to manage already running or not running services.

Most important commands

  • systemctl
    • Show all loaded services and their status
  • systemctl start nginx
    • Start the service nginx
  • systemctl stop nginx
    • Stopp the service nginx
  • systemctl restart nginx
    • Restart the service nginx completely new (disconnects ALL currently active connections)
  • systemctl reload nginx
    • Reload the current configuration for the service nginx neu ein (doesn’t disconnect ANY currently active connections)
  • systemctl status nginx
    • Show the current status of the service nginx
  • systemctl enable nginx
    • Add the service nginx to the autostart
  • systemctl disable nginx
    • Remove the service nginx from the autostart

I don’t have systemd in my linux distribution!

Dependent on your used linux distribution and version you might not have systemd installed and configured.

The most common distributions already have migrated to systemd over the last few years. Ubuntu since 2015, Debian since 2014, CentOS since 2014, Arch since 2012 and Fedora since 2011. See HERE for the current list.

Predecessor of the systemd was initd or SysVinit (again dependent on your used distribution)

Where can I find the config for all the already present services in systemd?

The config files for services, which come preinstalled and preconfigured by the distribution, can be found in /lib/systemd/system.

All config files for later installed services can be found in /etc/systemd/system.

Also every user can defined their own services in ~/.config/systemd/user.

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.