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
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
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.
The correct answer is C. Create a unit file in the /etc/systemd/system/ directory.
upvoted 2 times
...
This section is not available anymore. Please use the main Exam Page.XK0-005 Exam Questions
Log in to ExamTopics
Sign in:
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.
linux_admin
Highly Voted 1 year, 2 months agolinux_admin
1 year, 2 months agoAlizadeh
Most Recent 8 months, 3 weeks ago