scrapy crawl命令没有从crontab运行

时间:2013-05-24 13:19:30

标签: scrapy crontab

这是我的脚本:(test2.sh)

#!/bin/sh
echo try1 > run1.txt
cd /home/folder1/folder2
echo try2 > run2.txt
scrapy crawl somepage > /root/sans1.txt
echo try3 > run3.txt

这是我的cron文件:

00 * * * * cd /root && sh test2.sh >> /root/diggi.log

创建了所有文件run1.txt,run2.txt,run3.txt和sans1.txt .....我正在为run1,2,3获取正确的输出,但scrapy命令似乎不起作用我将sans1.txt作为空文件

1 个答案:

答案 0 :(得分:4)

首先你需要做chmod u+x test2.sh

还包含安装了scrapy的.sh文件路径

#!/bin/sh
PATH=$PATH:/usr/local/bin
export PATH
scrapy crawl somepage > /root/sans1.txt

然后尝试crontab

00 * * * * cd /root && test2.sh >> /root/diggi.log