From the course: Cert Prep LPIC-1 Exam 102 (Version 5.0)

Reccuring user jobs using cron - Linux Tutorial

From the course: Cert Prep LPIC-1 Exam 102 (Version 5.0)

Start my 1-month free trial

Reccuring user jobs using cron

- [Instructor] Systemd manages system services in CentOS 7. It also manages a lot of other objects like devices, system timers, and targets. The systemd equivalent to run levels. Systemd objects are called units and for each unit there's a unit file for configuration. For this course, we're only concerned with service units and service unit files. The command that systemd uses to manage these units is systemctl. To look at our service unit files type into a terminal, systemctl list-unit-files -at service and hit enter. By default, list-unit-files -t service will show all enabled service unit files. Enabled, meaning services that are configured to startup automatically. By adding -a, it will show both enabled and disabled service unit files. Notice that the systemctl subcommand is list-unit-files. This means we're just looking at the unit files and their status. We're not yet looking at the running status of services. The output will be in two columns. The first column is the service name. The second column is the service state which can be either enabled, disabled, or static. Enabled means it will start automatically at boot. Disabled means it will not start automatically. Static means that service is not enabled and has no provisions to be enabled. Some services are not meant to start automatically. Press Q to quit. Let's get more information about enabled services. Type in systemctl list-units -at service and hit enter. By default, list-units -t service shows enabled running services. By including the -a, it will also show enabled non-running services. If you disable and stop a service, it will no longer show up here. The output has five columns. The first column is the service name. The second column shows if the unit file was loaded. The third column, or active column, shows the general state of the service. The fourth column, or subcolumn, shows us more detailed information about its state including whether it's running or not. And the last column shows the description. Press Q to quit. We can filter by the state of the service. For instance, if we wanted to only list services that were active and currently running, we can type in, systemctl list-units -t service --state -running and hit enter. You'll notice the naming convention of the service files. In this case, rsyslog.service. All service files end with .service. Press Q to quit. You can view any of these unit files to get an idea how they work. I'm going to choose the rsyslog.service. Type in clear and then type in, systemctl cat rsyslog and hit enter. Notice the service name was rsyslog.service but the command worked without the extension. What we see here is the unit file, which determines the service dependencies, what command it executes, and what the service should do if the command fails. We can also get the status of a single service, as well. Type in clear again and hit enter. Type in, systemctl status rsyslog and hit enter. This gives us the status of the service, when it started, what the process ID number is, and some log messages.

Contents