Scheduling a Systemd Service Job with Timer Units

1 hour
  • 3 Learning Objectives

About this Hands-on Lab

Once a system administrator grasps creating custom services, this last piece will complete the puzzle. This learning activity will allow the student to gain an understanding of systemd timer units through the creation of one that is associated with a custom service. Once completed, the student will have an understanding of custom services, how they are created, and how to schedule and use them.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a Service Timer Unit File

Follow the scenario to create the appropriate timer unit file.

Putting Files Where They Belong

Copy the service and timer files and the shell script into the correct locations.

Run the Custom Service

Once the backup service has been created successfully from the scenario, make sure it is running so the backup will happen as scheduled.

Additional Resources

During the time that your development team has spent working on the new web-based API for your organization, there have been several instances of mistaken keystrokes or processes that have necessitated the restoration of the site directory from backup.

You have been asked to run periodic backups of the website directory and, given that the development environment does not have access to the backup network, you have decided to write a custom service that will do so.

You have previously written the systemd unit files to back up the site. You have been provided a file called web-backup.sh in your /root directory (NOTE: you will need to become the root user to complete your work). Using that file and the associated web-backup.service, create a systemd timer unit file that will control the schedule of your service.

After you have all three components ready, stage the files in their appropriate locations and start the service for your team and turn it back over for their use.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?