Ubuntu16.04 Crontab scheduled task installation and use

table of Contents

installation 

Configuration

command


installation 

sudo apt-get install cron

Configuration

View

crontab -l

edit

crontab -e

The first editor chooses the third vim editor. You can reselect the wrong selection, execute select-editor from the command line

*    *    *    *    *
-    -    -    -    -
|    |    |    |    |
|    |    |    |    +----- 星期中星期几 (0 - 7) (星期天 为0)
|    |    |    +---------- 月份 (1 - 12) 
|    |    +--------------- 一个月中的第几天 (1 - 31)
|    +-------------------- 小时 (0 - 23)
+------------------------- 分钟 (0 - 59)

* * * * *    每分钟执行
*/5 * * * *  每5分钟执行
0 * * * *    每小时执行
0 0 * * *    每天执行
0 0 * * 0    每周执行
0 0 1 * *    每月执行
0 0 1 1 *    每年执行
5 * * * *    每小时的第5分钟执行

Example: execute test.sh every minute

* * * * * bash /home/lp01/Desktop/test.sh

command

View status

service cron status

start up

service cron start

stop

service cron stop

Reboot

service cron restart

Reload configuration

service cron reload

OK.

 

Published 52 original articles · praised 34 · 10,000+ views

Guess you like

Origin blog.csdn.net/weixin_43789195/article/details/104556048