Ubuntu timed task Management crontab

Source: Internet
Author: User

Crontab is a regular task management tool under Linux, and the system is self-contained.
Crontab for each user to configure the profile, the root user profile in/etc/crontab, the normal user profile we can/var/in the configuration file .... We can modify the configuration file directly to add additional tasks, but this is often not recommended. Because Crontab provides a more secure way.

Management of crontab tasks

Crontab-e #编辑任务
crontab-r #移除所有任务
crontab-l #显示当前所有任务
crontab taskfile #用taskfile里面的任务列表来配置crontab

When you need to manage many tasks, especially when each machine in the cluster is managed, it is very necessary to initialize the crontab with your own configuration file.
Crontab-l > My_task
Crontab My_task

basic format for task configuration
* * * * command
Time-sharing and Lunar Week command

The 1th column represents the minute 1~59
The 2nd column represents the hour 1~23 (0 for 0 points)
The 3rd column represents the date 1~31
The 4th column represents the month 1~12
The 5th list of the week 0~6 (0 for Sunday)
6th column the command to run

Each column time can have the following form:
* Means each
Numbers mean every time this moment
Numbers, Numbers,... Which means that every time these digital moments
*/n represents every N
a-b/n in A,b range per n

Such as
* * * * command means every minute
*/2 * command means every 2 hours
0 1 * * * command means 01:00 every day
0 1,3,5 * * * command means every day 01:00, 03:00, 05:00 time

Task Start
When the task is configured, start or restart the Crontab service with the following command

sudo service cron Start|stop|restart
Author Introduction

Tang Riche , a graduate student of the State Key Laboratory (PDL) for parallel and distributed computing at National Defense Science and Technology University, began contacting spark in 14, preparing to contribute their own code to the spark-related open source community for the remainder of the study period, and is prepared to continue doing so after graduation.
Email: tanglizhe1105@qq.com

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.