nerdexam
CompTIA

XK0-005 · Question #59

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…

The correct answer is A. nohup service network restart. To prevent a script from being terminated when its controlling terminal closes or a network connection drops, the nohup command should be used.

System Management

Question

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?

Options

  • Anohup service network restart
  • Bservice network restart &
  • Cecho "service network restart" | at now
  • Ddg service network restart

How the community answered

(40 responses)
  • A
    83% (33)
  • B
    10% (4)
  • C
    5% (2)
  • D
    3% (1)

Why each option

To prevent a script from being terminated when its controlling terminal closes or a network connection drops, the `nohup` command should be used.

Anohup service network restartCorrect

The `nohup` command runs a command immune to hangups, meaning it prevents the process from receiving the SIGHUP signal which is typically sent to processes when the controlling terminal is closed or a network connection drops, ensuring the network restart script completes.

Bservice network restart &

Appending `&` to a command runs it in the background, but the process can still receive a SIGHUP signal and be terminated if the terminal session ends.

Cecho "service network restart" | at now

`at now` schedules a command to run immediately in a new shell environment, which might survive a session drop, but `nohup` is specifically designed to make a process immune to hangups from terminal closure or network loss.

Ddg service network restart

`dg` is not a standard Linux command for preventing scripts from being killed upon session termination.

Concept tested: Process management - nohup command

Source: https://man7.org/linux/man-pages/man1/nohup.1.html

Topics

#nohup command#Remote administration#Network configuration#Process management

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice