A system administrator needs to run a lengthy data processing script named process_data.sh on a remote server. The administrator must ensure the script continues to run to completion even after they disconnect their SSH session. Which of the following commands will achieve this?
The correct command is nohup ./process_data.sh &. The nohup command makes the script ignore the SIGHUP (hangup) signal, which is sent to processes when the controlling terminal (like an SSH session) is closed. The ampersand (&) at the end places the command into the background, returning the shell prompt to the administrator and allowing them to log out while the script continues to run.
bg ./process_data.sh is incorrect. The bg command is used to resume a stopped job in the background, not to start a new one in a way that protects it from session termination.
./process_data.sh && exit is incorrect. This command runs the script in the foreground and will only execute the exit command after the script has completely finished. The session remains active and tied to the script until it is done. If the SSH connection drops, the script will be terminated.
exec ./process_data.sh is incorrect. The exec command replaces the current shell process with the script's process. It does not put the process in the background, and it will still be terminated if the session is closed.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does 'nohup' do?
Open an interactive chat with Bash
What is the role of the ampersand '&' in a Linux command?
Open an interactive chat with Bash
What is the difference between 'bg' and 'nohup'?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access