Linux time to perform the task of the method in Linux you should first input crontab-e, then there will be a VI editing interface, and then input 0 3 * * 1/clearigame2 content to the inside: Wq save exit. in Linux, the task of cycle execution is typically handled by cron this daemon [ps-ef|grep cron]. Cron reads one or more configuration files that contain the command line and the time it was invoked. The cron profile is called "crontab" and is shorthand for "cron table". A, Cron finds profiles in 3 places: 1,/var/spool/cron/This directory contains the Crontab tasks for each user, including root, each of which is named after the creator, For example, Tom built a crontab task corresponding to the document is/var/spool/cron/tom. Generally a user has a maximum of one crontab file. II,/etc/crontab This file is responsible for arranging the maintenance system and other tasks crontab by the system administrator. /etc/cron.d/This directory is used to store any crontab files or scripts to be executed. Iv. permissions crontab permission issues to/var/adm/cron/next look, file Cron.allow and Cron.deny are used as follows: 1, if two files do not exist, Only the root user can use the crontab command. 2, if Cron.allow exists but Cron.deny does not exist, only users listed in the Cron.allow file can use the crontab command and the root user cannot use crontab if the root is not inside. 3, if Cron.allow does not exist, Cron.deny exists, only users listed in Cron.deny file cannot use the crontab command, which can be used by other users. 4, if two files exist, users listed in the Cron.allow file and not listed in Cron.deny can use crontab, if all two files have the same user, If the user is in the Cron.allow file, if the user is in Cron.allow, you canTo use the crontab command. How to enter the command and time to execute in the crontab file. Each row in the file includes six fields, the first five of which are the time when the command was executed, and the last field is the command to be executed. Separate fields with spaces or tabs. The format is as follows: minute hour day-of-month month-of-year day-of-week commands Legal value 00-59 00-23 01-31 01-12 0-6 (0 is Sunday) commands (on behalf of the script to be executed) There are several special symbols in addition to the numbers "*", "/" and "-", ",", * represent all values within the range of numbers, "/" for each Meaning, "/5" means every 5 units, "-" Represented from a number to a number, "," separate several discrete numbers. Basic format: *****command time-sharing week command 1th column means minutes 1~59 per minute with * or */1 for 2nd column for hour 1~23 (0 for 0 points) &nbs P The 3rd column indicates the date 1~31 4th column represents the month 1~12 5th column identification Number week 0~6 (0 for Sunday) 6th column Some examples of the command crontab files to run: #每晚的21 : 30 restart Apache. * * * */usr/local/etc/rc.d/lighttpd restart #每月1, 10, 22nd 4 1,10,22 * * */usr/local/etc/rc.d/lig httpd restart #每天早上6点10分 6 * * * Date #每两个小时 0 */2 * * * Date #晚上11点到早上8点之间每两个小时, 8 a.m. Point 0 23-7/2,8 * * * Date #每个月的4号和每个礼拜的礼拜一到礼拜三的早上11点 0 4 * mon-wed date #1月份日早上4点 0 4 1, * date Many times, we plan tasks that need to be executed in seconds, and you can easily perform tasks in seconds, depending on the following methods. /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
Source: http://www.2cto.com/os/201511/451426.html