定时启动爬虫

# 查看命令得绝对路径
# which scrapy
# cd到爬虫得项目目录下 + scrapy命令得绝对路径  +  启动命令

*/5 * * * * cd /opt/mafengwo/mafengwo/spiders && /usr/bin/scrapy crawl mfw_spider >>/var/log/cron_error.log 2>&1   # 将正确和错误日志都打印到日志中

每5分钟执行一次mfw_spider这个爬虫程序


tail -f /var/log/cron    监测定时任务运行得日志

 crontab -e     创建定时任务

 crontab   -l   查看定时任务

 service crond stop  停止定时任务

 service crond restart  重启定时任务

 service crond start  启动定时任务

liunx系统下crontab定时启动Scrapy爬虫程序

 

 

相关文章:

  • 2022-02-27
  • 2022-12-23
  • 2021-09-19
  • 2021-10-17
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
  • 2022-01-26
猜你喜欢
  • 2021-06-19
  • 2021-05-30
  • 2022-12-23
  • 2022-01-29
  • 2022-02-04
  • 2022-12-23
  • 2021-12-27
相关资源
相似解决方案