Scheduling Processes in SUSE Linux Enterprise

30 minutes
  • 2 Learning Objectives

About this Hands-on Lab

In this hands-on lab, we will be looking at scheduling processes to run on a schedule. We will perform some troubleshooting on a user account to ensure the process is working correctly, and then we will create a task as the `root` user to ensure our time is synced correctly on our server.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Verify the `testuser` Can Create Scheduled Tasks
  1. Access the testuser‘s account:

    su - testuser 

    The password is Password!

  2. Create a file named test.sh that echoes the string "this is a test" into an examplefile:

    vim test.sh
    
    ++contents
    #! /bin/bash
    echo 'this is a test' >> /home/testuser/examplefile

    Save and exit the file with Escape and then Shift+ZZ.

  3. Make the file executable:

    chmod +x test.sh
  4. Open testuser‘s crontab and add a task:

    crontab -e
  5. Add this line:

    * * * * * /home/testuser/test.sh

    Save and exit with Escape and then Shift+ZZ.

  6. Tail the file examplefile and ensure a line is appended every minute:

    tail -F examplefile
  7. Hit Ctrl+C to quit.

  8. Remove the task from the crontab:

    crontab -e
  9. On the line with the task, press d twice.

  10. Save and exit with Escape and then Shift+ZZ.

Create a Task as `root` that Syncs the System Clock to the Hardware Clock
  1. Open the root crontab:

    sudo -i crontab -e
  2. Add the task to run the backup at 3 AM:

    SHELL=/bin/bash
    PATH=/sbin
    00 03 * * * /usr/local/bin/customback /opt/programdata

    Save and exit with Escape+X.

  3. Verify the task exists in the root crontab:

    sudo -i crontab -l

Additional Resources

You have received two complaints about the same server. The first one is from a user named testuser whose password is Password!. This user has indicated his crontab is not working and he is not able to schedule jobs. You need to ensure this user can create scheduled jobs.

The second complaint is that there is not a backup in place. You will need to create a task that executes the /usr/local/bin/customback /opt/programdata command as root every morning at 3 AM.

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?