In Linux, at is used to specify the execution of a specified task at a specified time. The syntax is "at parameter time"; the at command is a one-time scheduled task, which will not be executed after the specified task is executed. Task, when using the at command, be sure to ensure that the atd process is started.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
What is the usage of at in Linux
The at command is a one-time scheduled task, and the daemon process atd of at will run in background mode , check the job queue to run the job. The atd daemon will check a special directory on the system to obtain the jobs submitted by the at command. By default, the atd daemon checks the directory every 60 seconds. When there is a job, it will check the job running time and if the time matches the current time , then run this job.
Note: The at command is a one-time scheduled task. After executing a task, this task will no longer be executed.
1. at command format
at [option] [time]
Ctrl D End the input of the at command
When using the at command, Be sure to ensure that the atd process is started.
2. at command parameter
option meaning
-m When the specified task is completed, an email will be sent to the user, even if there is no standard Output
-I alias of atq
-d alias of atrm
-v display The time when the task will be executed
-c Print the contents of the task to standard output
-V Display version information
-q
Use the specified queue -f
Read tasks from the specified file instead of reading from standard input -t
3. Time definition
at allows for a rather complex set of methods of specifying time:
can accept hh:mm (hour:minute) time specifications within the current day. If the time has passed, it will be executed the next day. For example: 04:00
You can use vague words such as midnight (late night), noon (noon), teatime (tea time, usually 4 p.m.) to specify the time.
You can use the 12-hour clocking system, that is, add AM (morning) or PM (afternoon) after the time to indicate whether it is morning or afternoon. For example: 12pm
can specify the specific date of command execution, and the specified format is month day (month day) or mm/dd/yy (month/day/year) or dd.mm. yy (day.month.year), the specified date must follow the specified time. For example: 04:00 2009-03-1
can use relative timing. The specified format is: now count time-units, now is the current time, time-units is the time unit, which can be minutes, hours, days, 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 commands
1) at: perform a one-time task at a specific time;
2) atq: list the user's Scheduled tasks, if it is a super user, all user tasks will be listed. The output format of the results is: job number, date, hour, queue and user name;
3) atrm: delete at tasks based on job number;
4) Batch: Execute at tasks when the system load allows, that is, execute at tasks when the system is idle.
5. Related configuration files
1) The exact definition of the time specification can be viewed in /usr/share/doc/at-3.1.13/timespec;
2 ) By default, scheduled tasks are stored in the /var/spool/at/ folder;
3) The root user can use the at command under any circumstances, and the permissions of other users to use the at command are defined in In the /etc/at.allow (users who are allowed to use scheduled tasks) and /etc/at.deny (users who are denied the use of scheduled tasks) files, there are no files by default. You need to create the allowed user and denied user files yourself;
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, / etc/at.deny exists, and 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 the executing user can execute the at command, First check whether the at.allow file exists before looking at the at.deny file;
7) If the /etc/at.allow and /etc/at.deny files do not exist, only the root user can use at ;
8) An empty /etc/at.deny means that any user can use the at command, which is the default configuration;
9) Generally, one of these two files is sufficient. If only a few users need to use scheduled tasks, then keep the at.allow file. If most users want to use scheduled tasks, then keep at.deny.
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of What is the usage of at in linux. For more information, please follow other related articles on the PHP Chinese website!

Maintenance mode is used for system maintenance and repair, allowing administrators to work in a simplified environment. 1. System Repair: Repair corrupt file system and boot loader. 2. Password reset: reset the root user password. 3. Package management: Install, update or delete software packages. By modifying the GRUB configuration or entering maintenance mode with specific keys, you can safely exit after performing maintenance tasks.

Linux network configuration can be completed through the following steps: 1. Configure the network interface, use the ip command to temporarily set or edit the configuration file persistence settings. 2. Set up a static IP, suitable for devices that require a fixed IP. 3. Manage the firewall and use the iptables or firewalld tools to control network traffic.

Maintenance mode plays a key role in Linux system management, helping to repair, upgrade and configuration changes. 1. Enter maintenance mode. You can select it through the GRUB menu or use the command "sudosystemctlisolaterscue.target". 2. In maintenance mode, you can perform file system repair and system update operations. 3. Advanced usage includes tasks such as resetting the root password. 4. Common errors such as not being able to enter maintenance mode or mount the file system, can be fixed by checking the GRUB configuration and using the fsck command.

The timing and reasons for using Linux maintenance mode: 1) When the system starts up, 2) When performing major system updates or upgrades, 3) When performing file system maintenance. Maintenance mode provides a safe and controlled environment, ensuring operational safety and efficiency, reducing impact on users, and enhancing system security.

Indispensable commands in Linux include: 1.ls: list directory contents; 2.cd: change working directory; 3.mkdir: create a new directory; 4.rm: delete file or directory; 5.cp: copy file or directory; 6.mv: move or rename file or directory. These commands help users manage files and systems efficiently by interacting with the kernel.

In Linux, file and directory management uses ls, cd, mkdir, rm, cp, mv commands, and permission management uses chmod, chown, and chgrp commands. 1. File and directory management commands such as ls-l list detailed information, mkdir-p recursively create directories. 2. Permission management commands such as chmod755file set file permissions, chownuserfile changes file owner, and chgrpgroupfile changes file group. These commands are based on file system structure and user and group systems, and operate and control through system calls and metadata.

MaintenanceModeinLinuxisaspecialbootenvironmentforcriticalsystemmaintenancetasks.Itallowsadministratorstoperformtaskslikeresettingpasswords,repairingfilesystems,andrecoveringfrombootfailuresinaminimalenvironment.ToenterMaintenanceMode,interrupttheboo

The core components of Linux include kernel, file system, shell, user and kernel space, device drivers, and performance optimization and best practices. 1) The kernel is the core of the system, managing hardware, memory and processes. 2) The file system organizes data and supports multiple types such as ext4, Btrfs and XFS. 3) Shell is the command center for users to interact with the system and supports scripting. 4) Separate user space from kernel space to ensure system stability. 5) The device driver connects the hardware to the operating system. 6) Performance optimization includes tuning system configuration and following best practices.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1
Easy-to-use and free code editor

Atom editor mac version download
The most popular open source editor
