Linux configure batch jobs using at command

Linux configure batch jobs using at command

The at command is a utility on Linux systems that allows you to schedule a command or script to be executed at a specified time in the future. This can be useful for running batch jobs or tasks on a regular basis.

To configure a batch job using the at command, you will need to follow these steps:

  1. Open a terminal and enter the at command, followed by the time you want the job to be executed. The time can be specified in several formats, such as hh:mm, hh:mm AM/PM, or noon, midnight, etc. For example:
refer‮ual:ot ‬tturi.com
at 13:00

This will open an at shell, where you can enter the command or script that you want to be executed.

  1. Enter the command or script that you want to be executed. You can enter multiple commands or scripts by separating them with a semicolon (;). For example:
echo "Hello, world!"; echo "This is a test batch job."
  1. Press Ctrl+D to exit the at shell and save the batch job. The job will be scheduled to run at the specified time.

You can use the atq command to view a list of pending at jobs, and the atrm command to remove a job from the queue. For example, to view the list of pending jobs, you can run:

atq

And to remove a job with a specific job ID, you can run:

atrm <job ID>

Keep in mind that the at command is typically restricted to users in the cron.allow file or to the superuser. If you are not able to use the at command, you may need to check your user permissions or consult your system administrator.

If you are not familiar with the at command or batch jobs on Linux, you may want to consult the at documentation or a reference guide for more information.

Created Time:2017-10-29 22:09:01  Author:lautturi