batch & at commands in Linux


at command


at: We can schedule jobs at a specified time using at command.

atq: This command lists all pending jobs. It shows Job number followed by date time and job class. at -l is similar to atq.

atrm: It is used to deletes a jobs identified by their job number. at -d is similar to atrm.
Examples:

to run a command cat file after 1 minute run the following

$ at now + 1 minute
 at> cat file
ctrl+d

$


at command Linux



Note that after at command we give the date and time when we want to execute the command, then give the commands. It can be a single command or many. To save and exit press ctrl+d.

to run at noon

$ at noon
similarly other ways are
$ at 10 am tomorrow
$ at 11:00 next month
$ at 22:00 today
$ at now + 1 week

The at.allow and at.deny files

The superuser may use these commands in any case. For other users, permission to use at is determined by the files /etc/at.allow and /etc/at.deny.

If the file /etc/at.allow exists, only usernames mentioned in it are allowed to use at.

If /etc/at.allow does not exist, /etc/at.deny is there, every username not mentioned in it is allowed to use at.

If neither exists, only the superuser is allowed use of at.
An empty /etc/at.deny means that every user is allowed use these commands, this is the default configuration.

batch Command:

batch: batch executes commands when system load is very low, when the load average drops below 0.8 the system executes the commands.
Example:
$ batch
  command1
  command2
  command3
  CTRL-d
 $



jobs fg bg commands in linux                                    Help in Linux               

 

No comments: