Given the following two symbolic links in a System V init configuration:
/etc/rc1.d/K01apache2
/etc/rc2.d/S02apache2
When are the scripts executed that are referenced by these links? (Choose two.)
Given the following two symbolic links in a System V init configuration:
/etc/rc1.d/K01apache2
/etc/rc2.d/S02apache2
When are the scripts executed that are referenced by these links? (Choose two.)
The S02apache2 script is executed when runlevel 2 is entered. In System V init configuration, scripts starting with 'S' in the /etc/rcX.d directory are executed upon entering the corresponding runlevel to start services. The K01apache2 script is executed when runlevel 1 is entered. Scripts starting with 'K' are executed to kill or stop services when entering the respective runlevel.
The Correct Answer is : A and E
this does not seem right to me, this does: AE
I agree, AE is the correct answer in my opinon
Can't say for sure, but what @Zeist said resonates more intuitively for me. I think that K01apache2 script (Answer C) is read by the OS and is promptly killed before the service can be started / has already started. "deactivated service" may not apply because the service could have been started prior to the scripts being executed. I would go for A and E.
question is When are the scripts executed. So A and E is an answer to the question. C is not the explicit answer to the question.
The first letter of the link filename in the runlevel’s directory indicates if the service should be started or terminated for the corresponding runlevel. A link’s filename starting with letter K determines that the service will be killed when entering the runlevel (kill). Ref: https://learning.lpi.org/en/learning-materials/101-500/101/101.3/101.3_01/
A. S02apache2 is run when runlevel 2 is entered. This is because the symbolic link in /etc/rc2.d starts with the letter "S", which stands for "Start", and is followed by a number that determines the order in which the scripts are executed when entering the corresponding runlevel. C. K01apache2 is never run because K indicates a deactivated service. This is because the symbolic link in /etc/rc1.d starts with the letter "K", which stands for "Kill", and is followed by a number that determines the order in which the scripts are executed when leaving the corresponding runlevel. Therefore, the correct answers are A and C.
I think the answer is A and E.
AE: Regarding the E, we all agree that K indicates that THE SERVICE (apache2) won't take place in run level 1. But the question (and is somewhat ambiguous wording) ask about THE SCRIPT itself that will deactivate apache2. By following the logic of https://www.golinuxhub.com/2014/01/what-are-s-and-k-scripts-in-etc-rcxd/, the K scripts are in deed executed to stop the service. So, if the option C didn't include the K01 and just refer to the apache2 service that would be correct. But again, the reasoning of the question refers to the script itself, or at least that is the way it is written.
A and E
C is correct. The S stands for start and K for Kill. These are essentially links to the original scripts in /etc/rc.d. The numbers after S/K are the priority by which the services will be started/Killed
Both S and K links gives to OS instructions on how handle a specific service when an init state change happen. K and S indicate if the service will be started or stopped, the following number indicate the init level to which the script will be applied. Any link that start with K01 means that the relative service will be killed as soon as the system switch of init 1 (single user mode). A and E are correct.
I'm agree , AE are correct
I don't agree with you. The number indicates priority of execution, the init state is indicated in the folder containing the scripts. K00 will be executed first and K99 last. On the other hand, for me A is correct. E is wrong, that script will be run when leaving runlevel 1. C might be correct, because runlevel 1 is single-user mode used for system maintenance, and in that state, services are restricted to bare-minimum, and apache might be deactivated in that runlevel.