CompTIA Linux+ (XK0-004) — Question 75
An administrator needs to change the IP address on a server remotely. After updating the configuration files, a network restart is needed. However, the administrator fears that when the network connection drops, the network restart script will be killed before the new IP address has been set.
Which of the following commands would prevent the script from being killed?
Answer options
- A. nohup service network restart
- B. service network restart &
- C. echo ג€service network restartג€ | at now
- D. bg service network restart
Correct answer: A
Explanation
The correct answer is A, as using 'nohup' allows the command to continue running even if the session is terminated, ensuring the network restart completes. Option B runs the command in the background but does not protect it from being killed if the session ends. Option C schedules the command to run immediately but does not provide a safeguard against session termination. Option D sends the command to the background but similarly lacks protection from being killed.