LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

batch

Execute commands when system load permits

TLDR

Enter commands interactively, then press Ctrl-D to queue them
$ batch
copy
Queue a command read from stdin
$ echo "./backup.sh" | batch
copy
Queue commands from a file
$ batch -f [path/to/script.sh]
copy
Send mail when the job finishes, even with no output
$ echo "./backup.sh" | batch -m
copy

SYNOPSIS

batch [-f file] [-m] [-V] [-q queue]

DESCRIPTION

batch executes commands when system load levels permit. It queues jobs to run once the system load average drops below 1.5 (or the value specified when atd was started with -l), making it useful for scheduling non-urgent or resource-intensive tasks during low-usage periods.Unlike at, which runs commands at a specific time, batch waits for favorable system conditions and runs jobs as soon as they are met. batch is equivalent to `at -q b -m now`. Commands are read from standard input or from the file given with -f, and any output is mailed to the user upon completion. The atd daemon must be running to process queued jobs.

PARAMETERS

-f file

Read the job from file rather than from standard input.
-m
Send mail to the user when the job has completed, even if there was no output.
-q queue
Use the specified queue (a single letter). batch defaults to queue b.
-V
Print the version number to standard error and exit.
When no -f file is given, commands are read from standard input. Press Ctrl-D to end input when entering commands interactively.

CAVEATS

The atd daemon must be running for batch to work. Results are sent to the user's mail. The load-average threshold defaults to 1.5 and can be changed by starting atd with the -l option.

HISTORY

batch is part of the at package, providing job scheduling utilities for Unix systems.

SEE ALSO

at(1), atq(1), atrm(1), cron(1), crontab(1)

RESOURCES

Copied to clipboard
Kai