Ubuntu uses crontab for scheduled tasks

Source: Internet
Author: User
Today, I want to regularly execute some scripts of ipvs, so I checked a crontab command on the Internet and recorded the usage of this command for future search. cron is a [daemon] used to execute a trip task within a specified time period. Every user has a crontab file to allow them to specify the content and time to be executed. In addition, the system also has a crontab that allows tasks with rules such as alternate logs and updating local data. Environment: Required tn12.10

Today, I want to regularly execute some scripts of ipvs, so I checked a crontab command on the Internet and recorded the usage of this command for future search.

Cron is a [daemon] used to execute a trip task within a specified time period. Every user has a crontab file to allow them to specify the content and time to be executed. In addition, the system also has a crontab that allows tasks with rules such as alternate logs and updating local data.

Environment: Medium tn 12.10

1. Use the crontab-e command

This command is simple and can be entered directly.

#: Crontab-e

The following window appears (the first time you will be prompted to use the compiler, you can just select one)

Then you can enter the content you want to execute.

For example, */2 ***** date>/home/postgres/time. log indicates the system time of course written to the time. log file every two minutes.

Then press ctrl + X to exit and save.

2. After saving crontab, restart the crontab service to make the task take effect.

Sudo service cron restart

3. Check the result.

Vim/home/postgres/time. log

Parameter description (I am looking for many examples to see it .)

# M h dom mon dow command

M minutes 0-59

H hour 0-23

Dow Day 1-31

Mon Month 1-12

Dow-week 1-6 0 indicates Sunday

Command is the command to be executed

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.