200-901 Question 158
Single answerYou are a developer tasked with managing a microservices application deployed on a Linux-based server. The application consists of multiple services, each running as a systemd service. You need to make changes to the configuration of a specific service and restart it to apply the new settings. What sequence of steps should you follow to achieve this?
- A
Edit the service configuration file, run 'systemctl reload
', and verify the status using 'systemctl status ' - B
Stop the service using 'systemctl stop
', edit the configuration file, start the service using 'systemctl start ', and verify the status using 'systemctl status ' - C
Edit the service configuration file, then restart the service using 'systemctl restart
', and verify the status using 'systemctl status ' - D
Stop the service using 'systemctl stop
', edit the configuration file, reload the service using 'systemctl reload ', and verify the status using 'systemctl status '
Show answer and explanation
Correct answer: C
Explanation
To apply configuration changes to a systemd-managed service, you should first edit the service's configuration file, then restart the service using 'systemctl restart
- A. Incorrect.
'systemctl reload' is used to reload the service's configuration without stopping the service, but this may not apply to all services. If the service does not support reloading, this step will fail.
- B. Incorrect.
Stopping and starting the service may work, but it introduces unnecessary downtime and is not an efficient way to apply configuration changes when 'restart' can handle this in one step.
- C. Correct.
This is the correct process. Editing the configuration file, restarting the service using 'systemctl restart', and verifying its status ensures the new configuration is applied and the service is running correctly.
- D. Incorrect.
'systemctl reload' is not appropriate after stopping a service. Reloading applies only to running services, and this sequence would fail.