A, crond cron job is to support scalable Linux system to perform an automatic command or script functions
1, yum provides crond (see command packet source)
2, system timing task catalog file
- crond.hourly ------------ scheduled task to run the system directory files per hour
- crond.daily ------------- scheduled task to run the system directory files every day
- crond.weekly ------------- system scheduled task to run the file directory week
- crond.monthly ----------- system scheduled task to run this monthly catalog file
- cond.deny ---------------- system inhibits certain users scheduled tasks
-
crontab ------------------- timed task profile *
two ,
crontab the -l to view the current list of scheduled tasks
crontab -e to edit a scheduled task
/ var / spool / cron / root root users write timing tasks are automatically generated root in this directory timer job file
/ var / spool / cron / general username ordinary users write timing task automatically generates the average user name cron job file in this directory
systemctl Status crond
systemctl Start / STOP the crond
/ var / log / log the cron scheduled task
three ,
VI / etc / effect globally the crontabMoon and sharing peripheral
308 a day to do what 8.30 00 daily 12:00 What do / 10 9-18 10 minutes to make 1-5 day Monday to Friday 9:00 p.m. to 6:00 p.m. every what / 9, 10, 5 * do what point in 9:10 every 5 minutes 18:00
Example 1, 1:00 am every day, the / etc directory under the package back up to / tmp, demanding a different package file name (for crond immediately show the experimental results are written per minute)
DATE =date +%F
cd /
tar -zcvf $ DATE .tar / etc && cp $ DATE.tar / tmp /
Note: in order to perform regular tasks identified path have / bin / / usr / bin are two, some can not execute the command to write the absolute path (which see the absolute path) java environment variable, the environment variable written to / etc / profile fileExample 2, in order to create a ip address the name of the directory, / etc packaged and backed up to the next ip address directory name, different names every day
Investigation: ip add written in regular tasks required in the full path. Otherwise, the script can identify and execute scheduled tasks may not work
Note: there is often a need to create a directory or file is easy to remember the date in the build environment. Command displays the time and date on the significant importance