代码拉取完成,页面将自动刷新
# 这个文件执行会报错:No such file or directory错误 文件要改 unix格式
#! /bin/sh
export PATH=$PATH:/usr/local/bin
# 进入.py脚本所在目录
cd /home/python/spiders/
# 执行.py中定义的项目example,并指定日志文件,其中nohup....&表示可以在后台执行,不会因为关闭终端而导致程序执行中断。
nohup scrapy crawlall >> example.log 2>&1 &
# 最后 通过crontab -e命令新增一个定时器,定时执行当前shell脚本 每2小时执行一次
# 0 */2 * * * (/bin/sh /home/python/spiders/cron.sh) >> /home/python/spiders/scrapy.log
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。