crontabの使い方

2001 ワード

crontabの使い方

crontab –e :   crontab  , 。
crontab –l :  
crontab -r :   crontab  
crontab -ir :   crontab  

Crontabの例

#1.   12:01 a.m  , 。 , 。
1 0 * * * /root/bin/backup.sh

#2.  (Mon – Fri) 11:59 p.m  。
59 11 * * 1,2,3,4,5 /root/bin/backup.sh

# :
59 11 * * 1-5 /root/bin/backup.sh

#3.  5 
*/5 * * * * /root/bin/check-status.sh

#4.   1:10 p.m  
10 13 1 * * /root/bin/full-backup.sh

#5.   11 p.m  。
0 23 * * 1-5 /root/bin/incremental-backup.sh
# 
* * * * *   */1 * * * *

# 
0 * * * *

# 
0 0 * * *

# 
0 0 * * 0

# 
0 0 1 * *

# 
0 0 1 1 *

# 6 
0 6 * * *

# 
0 */2 * * *

 10 ,40 
10,40 * * * *

# 4 、5 、6 5 min、15 min、25 min、35 min、45 min、55 min 
5,15,25,35,45,55 16,17,18 * * *

crondサービスの起動・停止コマンド

 :systemctl start crond.service

 :systemctl status crond.service

 :systemctl stop crond.service

 :systemctl restart crond.service

参考博文https://blog.csdn.net/resilient/article/details/80963526 https://www.jianshu.com/p/9347dae3d893