Chapter 1 timed task
system timing task for all users
/ etc / crontab
User regular tasks
crontab -l list scheduled task
crontab -e to edit scheduled tasks
crontab -e / var / spool / cron / username is: The current user logged into the system
crontab syntax similar to visudo detection function
The company used the timing of the task configuration file
/ etc / crontab
crontab -e = / var / spool / cron / username
log file
/ var / log / cron
view the service
----- ------ centos6.x
/ etc Status /init.d/crond
/etc/init.d/crond STOP or restart Start
------ ------------ centos7.x
systemctl Status crond
PS -ef | grep crond
systemctl is-active crond
Day Monday sharing command
0-59 0-23 1-31 1-12 0-6 command
/ n - how often to perform tasks on behalf
/ n - how often to perform tasks on behalf of
1.1 Example
* is "each" means, for every minute hours, etc.
- represents a delimiter indicating a time period
, the time period represented by the partition means
&&
Every 5 minutes to perform a time synchronization
/ 5 / usr / sbin / ntpdate ntp1.aliyun.com daily 7:00 to 11:00 every hour run CMD command 00 7-11 cmd 2) daily 1:00 to / etc / backup package directory / tmp directory and requires a daily backup of a different name. 1. How to package the / etc directory 2. How to put the / tmp name 3. files require different every day on different dates 4. At the command line test 5. Write scripts and execute test scripts directory / Server / scripts 6. write the script the scheduled task once per minute for testing after 7.OK time and then changed to 1:00 timed task script files to make use absolute paths content output timing of the task if we do not store the full path to the default home directory