exam questions

Exam XK0-005 All Questions

View all questions & answers for the XK0-005 exam

Exam XK0-005 topic 1 question 116 discussion

Actual exam question from CompTIA's XK0-005
Question #: 116
Topic #: 1
[All XK0-005 Questions]

A Linux engineer needs to create a custom script, cleanup.sh, to run at boot as part of the system services. Which of the following processes would accomplish this task?

  • A. Create a unit file in the /etc/default/ directory.
    systemctl enable cleanup
    systemctl is-enabled cleanup
  • B. Create a unit file in the /etc/ske1/ directory.
    systemctl enable cleanup
    systemctl is-enabled cleanup
  • C. Create a unit file in the /etc/systemd/system/ directory.
    systemctl enable cleanup
    systemctl is-enabled cleanup
  • D. Create a unit file in the /etc/sysctl.d/ directory.
    systemctl enable cleanup
    systemctl is-enabled cleanup
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
linux_admin
Highly Voted 1 year, 2 months ago
Selected Answer: C
To create a custom script, cleanup.sh, to run at boot as part of the system services, the process that would accomplish this task is option C, "Create a unit file in the /etc/systemd/system/ directory". Here's how this can be done: Create the cleanup.sh script and place it in a suitable location. For example, in the /usr/local/bin directory. Create a new systemd unit file with the .service extension in the /etc/systemd/system directory. For example, create a file called cleanup.service. In the cleanup.service file, define the service by setting the service name, description, and the command to execute the script. For example: [Unit] Description=Cleanup script [Service] ExecStart=/usr/local/bin/cleanup.sh [Install] WantedBy=multi-user.target
upvoted 5 times
linux_admin
1 year, 2 months ago
Save and close the cleanup.service file. Use the systemctl command to enable the service to run at boot time: systemctl enable cleanup.service his will create the necessary symbolic links to start the cleanup.service unit automatically at boot time. Use the systemctl command to check the status of the service: systemctl is-enabled cleanup.service This command will show whether the service is enabled to start at boot time or not. After completing these steps, the cleanup.sh script will run automatically at boot time as part of the system services.
upvoted 2 times
...
...
Alizadeh
Most Recent 8 months, 3 weeks ago
Selected Answer: C
The correct answer is C. Create a unit file in the /etc/systemd/system/ directory.
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago