Chapter 4. Service management

Table of Contents

Services
Installing a service
Enabling and disabling services
Starting, stopping, and restarting services
Viewing service status
Scheduling a process to run later
Scheduling a process to run periodically

In this chapter, we will discuss service management in the Adélie Linux system. This will include long-running processes (or services), scheduling processes to run at a later time, and scheduling processes to run periodically.

[Note] Note

For the service management section of this chapter, an OpenRC installation is assumed. Other process management systems, including the s6 supervision suite, are not yet discussed in this documentation.

Services

A service, also called a daemon or server process, is a long-running process that provides a function for your computer, or for others on your network. A service may be a web server, print spooler, a screen resource manager, or any other useful process. There are a number of high-quality services packaged and available for you to install on your Adélie Linux system. Once you install one (or more), you will need to configure and enable them. You can then start, restart, stop, or view the status of any service on your system. In this section, we will use the OpenSSH remote shell service in our examples. OpenSSH allows you to remotely connect to your computer from another computer using your login name and password, and run commands on it from another computer.

Installing a service

Refer to Chapter 3, Package Management for detailed information about installing packages. When you install the openssh package using apk add openssh, you may notice that APK automatically installs the openssh-openrc package for you. Services packaged by Adélie Linux always include -openrc subpackages which allow you to quickly and easily bring up new services on your systems.

All available services are in the /etc/init.d directory; you may list the contents of this directory to determine what services are available on your computer.

Enabling and disabling services

[Warning] Security Notice

Remember to always review a service's documentation and best practices for configuration before enabling and starting the service.

To enable a service, you may use the command rc-update add SERVICE default, where SERVICE is the name of the service — in this example, sshd. This adds the service to OpenRC's default runlevel, which means the service will automatically start when the system is booted. You may configure other runlevels based on your needs; however, this process is beyond the scope of this handbook. Refer to the official OpenRC documentation for more information.

To disable a service, and prevent it from automatically starting on system boot, you may use the command rc-update del SERVICE default, where SERVICE is the name of the service.

Starting, stopping, and restarting services

To start a service, you may use the command service SERVICE start, where SERVICE is the name of the service you wish to start. To stop a service, you may use the command service SERVICE stop, and to restart, you may use the command service SERVICE restart.

Viewing service status

To view the status of a single service, you may use the command service SERVICE status, where SERVICE is the service for which you wish to view status. This command will output started if a service is currently running, stopped if a service is not currently running, and crashed if a service stopped running prematurely.

To view the status of all services on your system, you may use the command rc-status. If any services are listed under "Dynamic Runlevel: manual", these are services that have been started but do not belong to any runlevel. That means they have been started without being enabled first, and will not automatically start on next system boot.

Scheduling a process to run later

[Warning] Not Yet Written

This section has not yet been written.

Scheduling a process to run periodically

[Warning] Not Yet Written

This section has not yet been written.