Chapter04_scheduling Future Linux Tasks
To schedule a task:
At: one-time, after the completion of the No.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/B1/wKioL1XrvMLyXBnVAABnjOWtS1Y722.jpg "title=" 1.jpg " alt= "Wkiol1xrvmlyxbnvaabnjowts1y722.jpg"/>
ATQ: View current at task, equals at-l
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/B5/wKiom1XruqXyZpDKAABvl989XDQ118.jpg "title=" 2.jpg " alt= "Wkiom1xruqxyzpdkaabvl989xdq118.jpg"/>
The at of the second row is the result of the CRTL+D submission.
If there is no time specified, the task is performed at the point in time that the schedule was created on the day that the date was set.
Specify a point in time:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/B1/wKioL1XrvNnTPxcWAABbQajseHc104.jpg "title=" 3.jpg " alt= "Wkiol1xrvnntpxcwaabbqajsehc104.jpg"/>
Eight points after 10 days:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/B1/wKioL1XrvOTj0qVpAABc4pNx_p0736.jpg "title=" 4.jpg " alt= "Wkiol1xrvotj0qvpaabc4pnx_p0736.jpg"/>
From now on, execute in 20 minutes.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/B5/wKiom1XrusqxvSUaAABc8JlgY2k210.jpg "title=" 5.jpg " alt= "Wkiom1xrusqxvsuaaabc8jlgy2k210.jpg"/>
Delete a task Atrm or at-d
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/B1/wKioL1XrvP6iW4xGAAFBUcW2VaI222.jpg "title=" 6.jpg " alt= "Wkiol1xrvp6iw4xgaafbucw2vai222.jpg"/>
Regular users can also support scheduled tasks.
If you want to restrict a user from doing a scheduled task, the Vi/etc/at.deny
Write the user name that you want to reject directly.
To remove, delete the user within the At.deny, or create a at.allow that writes to the user you want to allow
Crontab: Recurring Scheduled Tasks.
CRONTAB-E: Editing
If no user is specified, the current user is scheduled for the task.
-u user-E indicates a scheduled task for a user
-L: View Scheduled Tasks
-U user-L view scheduled tasks for a specified user
#分 when Day Month Weekcommands that need to be executed: The relationship between these times is and the relationship, must all be satisfied, in order to execute the command, but "Day" and "Week" are or relations, both exist at the same time, only need to satisfy one of them.
If you do not care about a unit, or have "every" meaning, then the use of * ... when we emphasize the whole point, the sub-position needs to write 0
example * 7 * */bin/ Aa.sh Seven o'clock every day, this script is executed every 1 minutes
0 7 * * */bin/aa.sh executes the script once every seven o'clock
If more than one time period is required for a given time, use "," to separate
0,10,30 7 * 1,2,3,4,5/ bin/aa.sh Monday to Friday, seven points per day, 0 points, 10 minutes, 30 minutes. Execute
0,10,30 * * 1-5/bin/ aa.sh
0,10,30 * * /bin/aa.sh Monday to Wednesday and Saturday, 0,10,30 of seven points per day script
0-15/5 7 * * 1-5/bin/aa.sh from Monday to Friday, every 5 minutes from seven o'clock onwards, until 7:15 minutes.
Crontab Save location:/var/spool/cron based on user name crontab
Crontab-r Deleting a scheduled task
Ordinary can also do planning tasks.
To deny a user the ability to do a task, Vi/etc/cron.deny then joins the rejected user.
To delete a denied user, delete the Cron.deny, or join the user who needs to be allowed within/etc/cron.allow.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/B5/wKiom1XruuTQ-0AwAAB_q6E5TKg789.jpg "title=" 7.jpg " alt= "Wkiom1xruutq-0awaab_q6e5tkg789.jpg"/>
The script placed inside the red box. Every x will be executed once.
Thinking:
Crontab can only be accurate to seconds, do a scheduled task, how accurate to the second?
Crontab implementations in Linux perform tasks in seconds
Many times, we plan a task that needs to be done in seconds, and it's easy to perform tasks in seconds, depending on the following methods.
The following methods are executed every 10 seconds
1. Edit Crontab
Crontab-e
* * * * * */bin/date >>/tmp/date.txt
* * * * * * sleep 10; /bin/date >>/tmp/date.txt
* * * * * * sleep 20; /bin/date >>/tmp/date.txt
* * * * * * sleep 30; /bin/date >>/tmp/date.txt
* * * * * * sleep 40; /bin/date >>/tmp/date.txt
* * * * * * sleep 50; /bin/date >>/tmp/date.txt
2. Check the results
Tail-f/tmp/date.txt
* * * * * * * * * * * * *, as long as the command is executed
This article is from the "It_landscape" blog, make sure to keep this source http://huangyisan.blog.51cto.com/6925110/1691815
Linux_ Scheduled Tasks