Linux+ Systemd Service Management Flashcards
6 cards from real Linux practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 Linux+ Systemd Service Management flashcards as text
A system administrator needs to ensure that the `nginx` web server starts automatically upon system boot. Which of the following commands will accomplish this?
Answer: systemctl enable nginx
The `systemctl enable ` command creates the necessary symbolic links in the systemd directories to ensure that the specified service is started automatically at boot time. The `start` command only starts the service for the current session.
After modifying the configuration file for a running service, which `systemctl` command should be used to apply the changes without stopping the service if possible?
Answer: systemctl reload httpd
The `systemctl reload ` command tells the service to reload its configuration files without a full restart. This allows for configuration changes to be applied without interrupting the service's operation, which is preferable to a `restart` that stops and starts the entire process.
A Linux administrator is troubleshooting a service named `customapp.service` that is failing to start. Which command will provide detailed information about the service's status, including recent log entries?
Answer: systemctl status customapp.service
The `systemctl status ` command provides a comprehensive overview of a service's current state, including whether it is active, its PID, and the most recent log messages from the journal related to that unit, which is crucial for troubleshooting.
Which of the following commands prevents a service from being started, either manually or by another service, by creating a symlink to `/dev/null`?
Answer: systemctl mask cron.service
The `systemctl mask ` command is a stronger version of `disable`. It creates a symbolic link from the service's unit file to `/dev/null`, making it impossible for systemd to start the service until it is unmasked. `disable` only prevents it from starting at boot.
A system administrator has created a new systemd unit file at `/etc/systemd/system/newapp.service`. What is the immediate next step required to make systemd aware of this new service file before it can be started or enabled?
Answer: systemctl daemon-reload
Whenever a new unit file is created or an existing one is modified on disk, the `systemctl daemon-reload` command must be run. This command tells the systemd manager to reload its configuration from the disk, making it aware of the changes.
To view all available service unit files on the system and see their current state (e.g., enabled, disabled, static), which command should be used?
Answer: systemctl list-unit-files --type=service
The `systemctl list-unit-files` command is used to list all available unit files and their status. Appending `--type=service` filters this list to show only service units. In contrast, `list-units` only shows units that are currently loaded into memory.