The code in crontab 0 * * * * cd /home/scrapy/foo/ && scrapy crawl foo >> /var/log/foo.log
It failed to run the crawl, as there was no log in my log file. I tested using 0 * * * * cd /home/scrapy/foo/ && pwd >> /var/log/foo.log
, it echoed '/home/scrapy/foo' in log.
I also tried PATH=/usr/local/bin
and PATH=/usr/bin
, but no success.
I'm able to run it manually by typing cd /home/scrapy/foo/ && scrapy crawl foo
in command line.
Any thoughts? Thanks.
Problem solved. Rather than running the crawl as root
, use crontab -u user -e
to create a crontab for user
, and run as user
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.