10, crontab regular tasks

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
10, crontab regular tasks

  1. crond.hourly ------------ scheduled task to run the system directory files per hour
  2. crond.daily ------------- scheduled task to run the system directory files every day
  3. crond.weekly ------------- system scheduled task to run the file directory week
  4. crond.monthly ----------- system scheduled task to run this monthly catalog file
  5. cond.deny ---------------- system inhibits certain users scheduled tasks
  6. 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 crontab
    10, crontab regular tasks

    Moon 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


    10, crontab regular tasks

    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 file

    Example 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
    10, crontab regular tasks

    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
    10, crontab regular tasks

Guess you like

Origin blog.51cto.com/13858002/2432977