(1) point: execute a task at a certain time point in the future, and use two commands to implement at and batch
Enter the at time in the command prompt. Enter the task to be executed at that moment and support multiple tasks. after entering the first task, press enter to enter the second task, ctrl + d to submit the scheduled task
Time specifying method:
Absolute Time: HH: MM, DD. MM. YY, MM/DD/YY
Relative time: now + # Unit
Unit: minutes, hours, days, weeks
Fuzzy time: noon, midnight, teatime
The execution result of the At task is sent to the user who arranges the task by email.
Fg: Execute ls/etc/and cat/etc/fstab in three minutes.
View at job LIST command: at-l
Delete a job: ad-d job number.
At configuration file/etc/at. deny and/etc/at. allow
If deny exists independently, deny assumes that all users can use the at command.
If allow exists independently, only users in allow can use the at command.
If both exist, only users in allow can use the at command.
Batch: you do not need to specify the time to automatically execute the specified task when the system is idle. Other usage is similar to.
(2) Periodically execute a task
1. Cron: it is an uninterrupted service. However, sometimes shutdown or service interruption is caused by external factors, and the execution of the unexecuted task will not be executed in the past.
Anacron: cron supplements allow cron to resume normal execution of unexecuted tasks due to various reasons in the past.
2. Cron tasks are classified into system tasks and user tasks.
System cron task
Definition file/etc/crontab
Format: minute hour day month week user task
User cron task
Definition file/var/spool/cron/USERNAME
Format: minute hour day month week task