200-901 Question 159
Select 2You are tasked with managing a web application running on a Linux server. The application is controlled by a custom systemd service called 'webapp.service'. You need to ensure that the application starts automatically on system boot and verify its current status. Which set of commands should you use?
- A
sudo systemctl enable webapp.service
- B
sudo systemctl start webapp.service
- C
sudo systemctl status webapp.service
- D
sudo systemctl reboot webapp.service
- E
sudo systemctl disable webapp.service
Show answer and explanation
Correct answers: A, C
Explanation
The task requires ensuring that the 'webapp.service' starts automatically on system boot and verifying its current status. To achieve this, the 'sudo systemctl enable webapp.service' command is used to configure the service to start on boot, and 'sudo systemctl status webapp.service' is used to check the current status of the service. Other commands, such as starting or disabling the service, do not align fully with the task requirements.
- A. Correct.
This command enables the 'webapp.service' to start automatically on system boot, which is required as part of the task.
- B. Incorrect.
This command starts the 'webapp.service' immediately, but the task does not explicitly require starting the service at this moment.
- C. Correct.
This command checks the current status of the 'webapp.service', which is required to verify its state.
- D. Incorrect.
This command does not exist in systemd. It is an invalid option for managing services.
- E. Incorrect.
This command disables the 'webapp.service' from starting automatically on system boot, which contradicts the task.