| Back to logs list
crontab--
1.
use the crontab command function to modify crontab configuration file,
belstaff jacket, and then the configuration utility by the cron at the appropriate between the time
implementation, the command is all the user permissions.
2. format
crontab [-u user] file
crontab [-u user] -l
3. The main parameters
-e: the implementation of the text editor to set the schedule, default text editor is vi.
-r: remove the current schedule.
-l: lists the current schedule.
crontab file format as Where, M for minutes (0 ~ 59), H for hours (
0 ~ 23), D for days (1 ~ 31), m is the month (1 ~ 12), d on behalf of the week days (0 ~ 6,0 for the stars
of days). cmd to run the program, said it was sent to sh implementation, the Shell only USER, HOME, SHELL
three environmental variables.
4.
and at command than that, crontab command tasks for the fixed period.
5.
examples set a timer, the regular system prompts:
[cao @ www cao] # crontab-e
At this point the system will open a vi editor.
If you enter the following: 35 17 * * 5 wall it!
crontab command with the timing to achieve a daily virus scan
already introduced a simple crontab command operations, here to see some of the more important operations.
(1) create a file,
belstaff on sale, the file name of the set itself is assumed to be caoproject:
# crontab-e
(2) file as follows:
05 09 * * * antivir
with After the Save and quit vi editor. Avira antivir is a Linux virus software, of course, necessary to install the system in
system.
(3) use the crontab command to task list:
# crontab caoproject
that all users within the system every day at 9:05 chapters automatically scanned for viruses.
/ sbin / service crond start / / start the service
/ sbin / service crond stop / / close the service
/ sbin / service crond restart / / restart the service
/ sbin / service crond reload / / reload the configuration
============================
crontab command is used to regularly perform the specified command, functions similar to Windows under the
Linux system, users simply execute the command sequence to be added to crontab file, the operating system will perform according to user configuration of the time sequence of these commands.
adding instructions to the crontab file, you need to check the crontab service is started and whether at startup:
view the crontab service state: service crond status
crontab manually start the service: service crond start
View crontab service is set to boot, execute the command: ntsysv
open the service configuration, view the crond service before the [] is selected (to play * is selected),
belstaff sale, if not checked then select the service .
use the command: crontab-l to view the current user has configured Task Scheduler
edit crontab file command: crontab-e
can not use writes the command sequence, such as file name
default, all users can use the system crond service. For more information on the use of unrestricted crond service, you can use the configuration file / etc / cron.allow and / etc / cron.deny, the words too literally, cron.allow is to allow users to use crond service list, cron.deny the opposite in the user
crontab command syntax is as follows:
Formats: crontab [-u user] file
This command is used to add a new crontab file
-u If you use this option, the specified user crontab file is modified, and otherwise modify the implementation of the user's crontab file crontab command.
Format II: crontab [-u user] [-e |-l |-r]
-l in the standard output to display the current crontab.
-r Remove the current crontab file.
-e using the system editor to edit the current crontab file. When editing is complete, the file will be automatically installed. This approach is very convenient, revised with immediate effect.
nonsense for a long time, here is the point. crontab file in the command format is as follows:
minute hour day-of-month month-of-year day-of-week commands
that: is time, the last paragraph is your regularly executed. Spaces between each, or tab-delimited. 5
look at that before the date and time range:
1, min [00-59]
2, h [00-23]
3, at [01-31 ]
4, the month [01-12]
5, weeks [0-6]; attention,
belstaff jackets, where 0 indicates Sunday
OK, point to a simple example,
belstaff shop, every morning 6:30 get:
30 06 * * * echo to / tmp / test.txt file add the line
above this instruction in the use of a special symbol , as in paragraph 3 of the
special symbols except used to represent a range, such as ] / 5 23 * * * / sbin / shutdown-h now
said the 11-point night started off once every 5 minutes trying to help you develop good habits early hours, huh, huh. After turning off the machine, if you try to boot, then to a multiple of 5 will turn off again, exactly like Windows 2000 in a shock virus.
00,10,20,30,40,50 * * * * echo 20 points,
belstaff leather, 30 points, 40 points, 50 points to the file
according to the above command format and time of description, you can let the system time in order to do strange things.