linux--->Scheduled tasks

linux scheduled task

crontab
  • cron service
    • cron is a timing execution tool under linux that can run jobs without human intervention.
    • service crond start //Start the service
      service crond stop //Close the service
      service crond restart //Restart the service
      service crond reload //Reload the configuration
      service crond status //View the service status
  • / var / spool / cron /
    • This directory stores the crontab tasks of each user including root. Each task is named after the creator. For example, the file corresponding to the crontab task created by tom is /var/spool/cron/tom. Generally, a user has at most one crontab file.
    • crontab -e run a text editor to set the schedule
      crontab -r : delete the current schedule
      crontab -l : list the current schedule
  • /etc/crontab
    • This file is responsible for arranging crontabs for maintaining the system as well as other tasks specified by the system administrator.
  • Format
    • Format of the crontab file: MHD md cmd.
      M: minutes (0-59).
      H: hours (0-23).
      D: Day (1-31).
      m: month (1-12).
      d: Day of the week (0~6, 0 is Sunday).
ps:
  • crontab sets the minutes, hours, days, months, and days of the week
  • Commands in the shell use absolute paths. You can use which to view the corresponding named path

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324470928&siteId=291194637