It was said that using crontab to implement timed tasks, if we just want to run a specific task once, then we need to use the AT Monitoring program.
First, at service
Cron is a timed execution tool under Linux that can run a job without human intervention.
Service ATD Start//Startup services
Service ATD Stop//Shutdown services
Service ATD Restart//Restart services
Service ATD Reload//Reload Configuration
Service ATD Status//view services statuses
Second, at in the configuration file:
At similar to the print process, the task is placed in the/var/spool/at directory and run at a specified time. The AT command is the equivalent of another shell, and when the at time command is run, it sends commands that can enter arbitrary commands or programs.
Three, detailed parameters
At [-v] [-Q x] [-F file] [-MLDBV] timeat-c job ... atq [-v] [-Q X]ATRM [-v] job ...
-V: Print version number
-Q: Stored with the specified queue (queue), where the data is stored in so-called queue, the user can use multiple queue at the same time, and the queue is numbered A, B, C ... z and a, B, ... Z total of 52
-M: Send a letter to the user even if there is no output after the program/instruction execution is completed
-F file: Read in a pre-written command file. The user does not have to use the chat mode to enter, you can first write all the specified file after the first read into the network application
-L: Lists all designations (users can also use ATQ directly without at-l)
-D: Delete specified (users can also use ATRM without at-d)
-V: Lists all completed but not yet deleted specified
At command execution process
# at 2:05 tomorrow
At>/home/kyle/do_job
At> Ctrl+d
The time representation method in
-----------------------------------------------------------------------
Time Example Description
-----------------------------------------------------------------------
Minute at now + 5 minutes task runs after 5 minutes
Hour at now + 1 Hour task runs after 1 hours
Day at now + 3 days task runs after 3
Weeks at now + 2 Weeks task runs after two weeks
Fixed at midnight task runs at midnight
Fixed at 10:30pm mission at night 10:30
Fixed at 23:59 12/31/2018 Task on December 31, 2018 23:59
[[email protected] ~]# at 5pm +3 daysat>/bin/date at> <eot>job 1 @ 2016-08-30 17:00[[email protected] ~]# at Q1 2016-08-30 17:00 a root[[email protected] ~]# at 2:05 tomorrowat> echo the end of world!at> <eot>job 2 At 2016-08-28 02:05[[email protected] ~]# atq2 2016-08-28 02:05 a root1 2016-08-30 17:00 a root[[email protected] ~]# atrm 2[[email protected] ~]# atq1 2016-08-30 17:00 a root
A detailed command of at timed execution tasks under Linux