Learning Linux: Systemd and You

Most modern Linux systems use systemd, which aims to consolidate how services are configured and how they behave, regardless of the Linux distribution. You don’t need to know the ins and outs of how the Linux system boots in order to make use of systemd. While it is helpful to have that knowledge, this article will only cover some basics to get you started.

The systemctl command is used for managing services. It’s worth noting that systemd manages more than services, but that’s outside the scope of this article. A look at man systemctl will show something similar to:

systemctl may be used to introspect and control the state of the “systemd” system and service manager.

One of its most basic uses is starting or stopping services. Using the Jungle Disk Server Backup service as an example, this can be done via these commands:

systemctl start junglediskserver.service
systemctl stop junglediskserver.service

The .service references the service’s unit file. Units are just resources that systemd knows how to manage. Since systemctl knows what you are referring to by default, you can actually leave off .service:
systemctl start junglediskserver
systemctl stop junglediskserver

You can also use restart to do both in one command. However, sometimes you make a configuration change and don’t want to stop the service, just reload the configuration. In that case, you can use reload. Not all services can do this, however, so you can also use reload-or-restart. This will reload if possible, or restart if it can’t.

You can also enable and disable service units, which are different from starting and stopping services. Enabling a service means that it will start on boot (if the unit’s configuration requirements are met). Starting a service starts it immediately. Disabling simply means it won’t start at boot (even if the unit’s conditions are met). As a result, you can start a disabled service without issue. Here’s an example of enabling a service: systemctl enable junglediskserver.

With any service, you can also get the status to see if it’s active or not:
systemctl status junglediskserver
This is different than using the ps command; a service running per ps is not by default started by systemd, and therefore is not necessarily managed by systemd.

These are just a few, basic examples of how to use systemd on your Linux system. These basics will certainly come in handy; even if you don’t use it now, at some point you will encounter it if you manage Linux systems. Stay tuned for more Linux tips!

Protect Your Business Data

We are passionate about helping our customers protect their data. We want you to use Jungle Disk to protect yours. Click on Sign Up to get started. It takes less than 5 minutes!

Sign Up