Enabling and disabling a service – and starting and stopping it
In the previous recipe, we added our daemon as a service to systemd with a unit file. In this recipe, we'll learn how to enable it, start it, stop it, and disable it. There is a difference between enabling and starting and disabling and stopping a service.
Enabling a service means that it will start automatically when the system boots. Starting a service means that it will start right now, regardless of it being enabled or not. And disabling a service means that it will no longer start when the system boots. Stopping a service stops it right now, regardless of it being enabled or disabled.
Knowing how to do all of this enables you to control the system's services.
For this recipe to work, you'll first need to complete the previous recipe, Writing a unit file for a daemon.
How to do it...
- Let's start by checking out the daemon status again. It should be both...