There are two types of scheduled tasks in Linux system, one is the at scheduled task which will only be executed once, and the other is the cron scheduled task which can be executed periodically. at One-time scheduled tasks describe Execute a specific command (single time) at a specified time, also called a delayed action task. usage at time [Enter] parameter at -l #List single scheduled tasks at -r task id ##Delete the task with this id at -d task id ##Delete the task with this id at -m #Make the command without output generate email at -M #Make the command with output generate email at -c task id ##View the action of the task with this id at -f file ##Use the commands recorded in the file as the execution commands of the delayed task Examples First check the system time [root@test ~]# date Thu May 17 18:40:11 CST 2018 Specify a single scheduled task (delayed action) [root@test ~]# at 18:45 ##Plan executed at 18:45 on the same day (18:45 2018-05-17) at> date ##Scheduled task content at> shutdown -h now ##Scheduled task content at> <EOT> ##Command input ends, press Ctrl+D to exit job 10 at Thu May 17 18:45:00 2018 ##The system prompts that there is a scheduled task numbered 10 Cron periodic scheduled tasks To use cron to schedule tasks, you need to ensure that the crond service is enabled and starts automatically at boot. # systemctl start crond # systemctl enable crond describe Maintain a periodic cron job file for each user. usage crontab [ -u user ] [ -l|-r|-e ] Options
corn plan task format
If you need to specify a time period, you can use a hyphen (-) to indicate a continuous period of time, a comma (,) to indicate several discontinuous periods of time, an asterisk (*) to indicate all periods of time, and a division sign (/) to indicate intervals of time. Example [root@test ~]# crontab -e : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Cron scheduled task permissions To prevent users from arbitrarily defining their own scheduled tasks, administrators can implement ACL access control. The control files for the at scheduled tasks are /etc/at.allow and /etc/at.deny. By default, at.llow does not exist. The control files for cron scheduled tasks are /etc/cron.allow and /etc/cron.deny. By default, cron.allow does not exist. The above article on how Linux users can customize at and cron scheduled task execution is all I have to share with you. I hope it can give you a reference, and I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Simple writing of MYSQL stored procedures and functions
>>: WeChat applet realizes taking photos and selecting pictures from albums
The vue mobile terminal determines the direction ...
This article shares the installation of MySQL 5.7...
MySQL full text search Chinese solution Recently,...
This article mainly introduces the simple impleme...
The most important thing for idea to package a we...
This article example shares the specific code of ...
We hope to insert the weather forecast into the w...
1Several common character sets In MySQL, the most...
We simply need to open any text editor, copy the f...
Preface This chapter uses basic Linux functions a...
Preface With the crazy speculation of virtual cur...
Table of contents Install Tomcat with Docker Use ...
Arrow function is a new feature in ES6. It does n...
Table of contents About MariaDB database in Linux...
Table of contents 1. Code analysis 2. Source code...