Manage or schedule jobs for executing commands

Shawon is a shortstop for the Chicago Cubs by day, and a RHEL Sysadmin at Google Chicago by night (he gets very little sleep). He has convinced the Cubs' management to host https://cubs.com/ on RHEL servers, and Shawon has been promoted to the position of RHEL Training and IT Director of the Chicago Cubs. About Shawon:

  • His RHEL Server: Chicago_Cubs_RHEL_Server_2016
    His username on the server: shawon.dunston@cubs.com
  • He professional preference: All good RHEL Sysadmins NEVER run Linux commands as the root user.
  • His task: Manage or schedule jobs for executing commands.

Google has just temporarily transferred 3 Google interns to the Chicago Cubs so that they can get hands-on RHEL training from Shawon Dunston, who is an expert. The 3 interns are also physically kind of weak, so Shawon will strengthen them up by giving the 6 weeks of baseball training at Wrigley Field. 

The 3 interns will take the LFCS exam in 10 weeks. Shawon need to teach them this objective: Manage or schedule jobs for executing commands.

Please generate and explain several example commands that Shawon can demonstrate to help the students to master this LFCS objective.

Sure! Here are some example commands that Shawon can demonstrate to help the students master the objective of managing or scheduling jobs for executing commands in RHEL:

  1. at: This command allows you to schedule a one-time job to be executed at a specific time in the future. Shawon can demonstrate how to use the at command to schedule a command to be executed at a later time, such as sending an email or running a backup script.

    Example: echo "Backup script" | at 10:00 AM tomorrow

  2. crontab: This command is used to manage and schedule recurring jobs. Shawon can demonstrate how to edit the crontab file to schedule commands that need to be executed at specific intervals, such as running a cleanup script every day at midnight or generating a system report every week.

    Example: crontab -e (to edit the crontab file)
    0 0 * * * /path/to/cleanup_script.sh (to schedule a cleanup script to run every day at midnight)

  3. systemd: Shawon can demonstrate how to use systemd timers to schedule and manage jobs. systemd is the default init system in RHEL and provides powerful job scheduling capabilities. Shawon can show the students how to create and manage systemd timers to execute commands at specific times or intervals.

    Example: systemctl start myservice.timer (to start a systemd timer)

  4. batch: The batch command is similar to the at command, but it executes the commands when the system load is low. Shawon can demonstrate how to use the batch command to schedule jobs that need to be executed when the system is relatively idle.

    Example: batch command-to-be-executed

  5. nohup: This command is useful when running long-running jobs or scripts that should continue running even after the user logs out. Shawon can demonstrate how to use the nohup command to execute a command that will continue running in the background, even if the terminal session is closed.

    Example: nohup ./long_running_script.sh &

These examples should provide a good foundation for the interns to understand and master the objective of managing or scheduling jobs for executing commands in RHEL. Shawon can further explain the syntax and options of each command and encourage the interns to experiment with different scheduling scenarios to enhance their understanding. 

You should also read: