nerdexam
CompTIACompTIA

XK0-005 · Question #1559

XK0-005 Question #1559: Real Exam Question with Answer & Explanation

The correct answer is B: Create a unit file for the new service in /etc/systemd/system/ with the name helpme.service in the. {"question_number": 2, "question": "A script made executable with chmod +x still won't run. What two things should be done?", "correct_answer": "B and C", "explanation": "Two issues must be fixed: (1) The script is missing a shebang line at the very top. A shebang (e.g., #!/bin/b

System Management

Question

A systems administrator is implementing a new service task with systems at startup and needs to execute a script entitled test.sh with the following content: The administrator tries to run the script after making it executable with chmod +x; however, the script will not run. Which of the following should the administrator do to address this issue? (Choose two.)

Options

  • AAdd #!/bin/bash to the bottom of the script.
  • BCreate a unit file for the new service in /etc/systemd/system/ with the name helpme.service in the
  • CAdd #!//bin/bash to the top of the script.
  • DRestart the computer to enable the new service.
  • ECreate a unit file for the new service in /etc/init.d with the name helpme.service in the location.
  • FShut down the computer to enable the new service.

Explanation

{"question_number": 2, "question": "A script made executable with chmod +x still won't run. What two things should be done?", "correct_answer": "B and C", "explanation": "Two issues must be fixed: (1) The script is missing a shebang line at the very top. A shebang (e.g., #!/bin/bash) must be the first line of the script - it tells the kernel which interpreter to use. Option A is wrong because placing it at the bottom does nothing; Option C correctly places the shebang at the top (the double slash in '#!//bin/bash' is a typo in the question but the intent is the correct first-line shebang). (2) To run the script as a service at startup under systemd, a unit file must be created in /etc/systemd/system/ with a .service extension (Option B). Option E is incorrect because /etc/init.d/ is the legacy SysV init directory, not used by modern systemd-based systems. Restarting or shutting down the computer (D, F) is not a fix for either issue.", "generated_by": "claude-sonnet", "llm_judge_score": 4}

Topics

#Shell Scripting#Script Execution#systemd#Service Management

Community Discussion

No community discussion yet for this question.

Full XK0-005 PracticeBrowse All XK0-005 Questions