Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use at in linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "how to use at in linux", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to use at in linux" this article.

In linux, at is used to specify the execution of a specified task at a specified time, and the syntax is "at parameter time"; the at command is an one-time scheduled task, which is no longer executed after the execution of the specified task. When using the at command, you must ensure that the atd process starts.

The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

The at command is an one-time scheduled task, and the at daemon atd runs in background mode, checking the job queue to run the job. The atd daemon checks a special directory on the system to get jobs submitted by the at command. By default, the atd daemon checks the directory every 60 seconds, checks the job run time when a job is available, and runs the job if the time matches the current time.

Note: the at command is an one-time scheduled task that is no longer executed after the execution of a task.

1. At command format

At [options] [time]

Ctrl + D ends the input of at command

When using the at command, make sure that the atd process starts.

2. At command parameters

Option meaning

-m when the specified task is completed, a message will be sent to the user, even if there is no standard output

-alias for I atq

Alias for-d atrm

-v shows the time when the task will be executed

-c print the contents of the task to standard output

-V displays version information

-Q uses the specified queue

-f read the task from the specified file instead of from standard input

-t submit the task to run in the form of a time parameter

3. Time definition

At allows you to use a rather complex set of time-specific methods:

Can accept the time specified in the hh:mm (hours: minutes) of the day. If that time has passed, it will be executed the next day. For example, 04:00

You can use vague words such as midnight (late at night), noon (noon) and teatime (tea time, usually 4 p.m.) to specify the time.

You can use a 12-hour timing system, that is, adding AM (morning) or PM (afternoon) after the time to indicate whether it is morning or afternoon. For example: 12pm

You can specify a specific date for the execution of the command, in the format of month day (month day) or mm/dd/yy (month / day / year) or dd.mm.yy (day. Month. The specified date must follow the specified time. For example: 04:00 2009-03-1

Can use relative timing method. The specified format is: now + count time-units, now is the current time, time-units is the unit of time, here can be minutes (minutes), hours (hours), days (days), weeks (weeks). Count is the amount of time, days, hours. For example: now + 5 minutes 04pm + 3 days

You can directly use today (today) and tomorrow (tomorrow) to specify the time to complete the command.

4. Related orders

1) at: perform one-time tasks at a specific time

2) atq: lists the user's scheduled tasks. If the superuser is a superuser, all users' tasks will be listed. The output format of the result is: job number, date, hour, queue and user name.

3) atrm: delete at tasks according to job number

4) batch: execute the at task when the system load allows, that is, execute the at task when the system is idle.

5. Related configuration files

1) the exact definition of the time specification can be seen in / usr/share/doc/at-3.1.13/timespec

2) by default, scheduled tasks are stored in the / var/spool/at/ folder

3) root users can use the at command in any case, while the permissions for other users to use the at command are defined in the / etc/at.allow (users who are allowed to use scheduled tasks) and / etc/at.deny (users who are refused to use scheduled tasks) files. By default, there is no file to create their own allow user and deny user files.

4) if the / etc/at.allow file exists, only the user corresponding to the user name in the file can use at

5) if the / etc/at.allow file does not exist and / etc/at.deny exists, all users who are not in the / etc/at.deny file can use at

6) at.allow has a higher priority than at.deny. Whether you can execute at commands depends on whether there are any at.deny files in the at.allow file.

7) if the / etc/at.allow and / etc/at.deny files do not exist, only root users can use at

8) an empty / etc/at.deny indicates that any user can use the at command, which is the default configuration

9) in general, one of these two files can be present. If only a few users need to use scheduled tasks, keep the at.allow file, and if most users want to use scheduled tasks, keep at.deny.

The above is all the contents of the article "how to use at in linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report