Scrapy scheduled task under centos, cannot be executed

clipboard.png

clipboard.png
execute after entering the project, the error shows scrapy command not found
, but I-sharpscrapy can be run, the scrapy crawl test crawler command can also be executed alone,
only the scheduled command will appear scrapy:command not found


The environment variables of

crontab are different from our accounts and root.
similar to ordinary users will first load ~ / .bashrc or / etc/profile , while crontab will load / etc/crontab to import their environment variables at run time.
so see if the command scrapy has been added to the crontab environment variables: / etc/crontab . < /

in fact, the easiest way is to use the absolute path when performing scheduled tasks in crontab:

2 2 *** cd /root/EIT/crawler/EIT && /path/to/scrapy crawl test

if you don't know where the scrapy command is, you can find the path by executing the following two commands:

  

is awesome. Thank you, boss!

Menu