我的cronjob执行多次。
我的设置错了吗?
请帮帮我
这是脚本
#!/bin/bash
source /home/obe/env/bin/activate
cd /home/obe/env/crawl/pjt/pjt
scrapy crawl gets
这是我设置的crontab,我使用centos7
* 23 * * * /home/obe/env/crawl/cron_set.sh
我使用ps aux | grep cron
我发现我的cronjob执行了很多次
root 1202 0.0 0.0 126336 288 ? Ss 17:16 0:02 /usr/sbin/crond -n
root 9870 0.0 0.0 113116 8 ? Ss 23:00 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 9908 0.0 0.0 113116 8 ? Ss 23:01 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 10203 0.0 0.0 113116 8 ? Ss 23:09 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 10238 0.0 0.0 113116 8 ? Ss 23:10 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 10269 0.0 0.0 113116 8 ? Ss 23:11 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 10328 0.0 0.0 113116 8 ? Ss 23:13 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 10370 0.0 0.0 113116 8 ? Ss 23:14 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 10412 0.0 0.0 113116 8 ? Ss 23:15 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 10455 0.0 0.0 113116 8 ? Ss 23:16 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 10594 0.0 0.0 113116 8 ? Ss 23:17 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 10631 0.0 0.0 113116 8 ? Ss 23:18 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 10660 0.0 0.0 113116 8 ? Ss 23:19 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 10699 0.0 0.0 113116 8 ? Ss 23:20 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 10731 0.0 0.0 113116 8 ? Ss 23:21 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 10753 0.0 0.0 113116 4 ? Ss 23:22 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 10779 0.0 0.0 113116 36 ? Ss 23:23 0:00 /bin/bash /home/obe/env/clawer/cron_set.sh
root 10802 0.5 0.0 112644 216 pts/2 S+ 23:23 0:00 grep --color=auto cron
为什么会发生这种情况?
答案 0 :(得分:0)
您的crontab * 23 * * * /home/obe/env/crawl/cron_set.sh 表示:
命令/home/obe/env/crawl/cron_set.sh将每天晚上11点执行。
如果你想让它在一天内运行一次,它应该是: 0 23 * * * /home/obe/env/crawl/cron_set.sh 这意味着
命令/home/obe/env/crawl/cron_set.sh将在每天晚上11点执行。
下次参阅:http://www.cronchecker.net/
快乐的朋友