Linux and Command-Line Basics
On a Linux system using systemd, which of the following is the difference between "systemctl start license.service" and "systemctl enable license.service" for the service license.service?
- Astart makes the service run automatically from the next boot of the computer, and enable starts the service right now
- Bstart starts the service right now, and enable sets it to start automatically when the computer boots
- Cstart runs the service as one only root can use, and enable allows ordinary users to operate the service too
Show answer and explanation
Answer: B. start starts the service right now, and enable sets it to start automatically when the computer boots
systemctl start starts the service right now, but the started state does not persist after a reboot. systemctl enable sets the service to be started automatically when the system boots, and enable alone does not start it now. To do both at once, use systemctl enable --now; stop stops it and disable removes the automatic start. Whether the service is running, and its recent log, can be checked with systemctl status.
- A. The roles of start and enable are reversed. start starts it immediately, and enable sets up automatic start at boot.
- B. Correct. start starts it now, and enable sets up automatic start at boot.
- C. start and enable do not decide who can operate the service.