简体   繁体   English

crontab:同一脚本仅在一天触发

[英]crontab: same script is triggered only on one day

I'm not a linux expert and need some support to a crontab mystery (for me).我不是 linux 专家,需要一些对 crontab 之谜的支持(对我而言)。 I'd like to do a backup of my raspberry pi twice a week.我想每周两次备份我的树莓派。 It's the same script.这是同一个脚本。 But only the every monday trigger (dow=1) executes.但只有每周一的触发器 (dow=1) 会执行。 The Friday rule (dow=5) does nothing at all - no backup saved.星期五规则 (dow=5) 什么都不做 - 没有保存备份。 I can't see why.我不明白为什么。 What's going wrong?怎么了? Where can I find out what's going wrong?我在哪里可以找出问题所在?

# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
0 4 * * 1 /home/pi/Backup/backup.sh > /dev/null
0 4 * * 5 /home/pi/Baclup/backup.sh > /dev/null

screenshot of crontab -e crontab -e 截图

You did everything correctly.你做的一切都是正确的。 You were just missing a second pair of eyes to see that you have a typo in the second line:您只是错过了第二双眼睛,发现您在第二行中有错字:

Baclup vs Backup BaclupBackup

;-) ;-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM