Raspberry Pi-Cron and Crontab (scheduled task)

Source: Internet
Author: User

Raspberry Pi-Cron and Crontab (scheduled task)

Cron is a tool for configuring scheduled tasks in Unix systems. It is used to execute commands or scripts on a regular basis or at a certain interval; the task scope can be to automatically back up the user's home folder every night, or to record CPU information logs every hour.

The crontab (cron table) command is used to edit the list of scheduled tasks in execution. The operation is based on each user, and each user (including the root user) has its own crontab.

Editing crontab (edit crontab)

Run crontab and-e to edit the cron table:

Crontab-e
Select an ediror (select an editor)

The first time you run the crontab command, you will be prompted to select an editor. If you are not sure which one to use, you can press enter to select the default nano editor.

Each cron object contains six parts: minute, hour, day of the month, and day of the week, and scheduled command.

# M h dom mon dow command # ***** command to execute # Too many commands available # │ #│ │ # │ ── ─ the day of the week (0-7) (from 0 to 6 indicates Sunday to Saturday. 7 indicates Sunday, equivalent to 0) # │ └ ── ─ month (1-12) # │ └ ── ─ day in the month (1-31) # │ ── ─ hour (0-23) # └ ── ─ minute (0-59)

For example:

0 0 ***/home/pi/backup. sh
The cron instance will execute the backup. sh script at midnight every day. Address: http://www.raspberrypi.org/documentation/linux/usage/cron.md

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.