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

定时启动爬虫

# 查看命令得绝对路径
# 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  启动定时任务

 

 

posted @ 2019-11-27 11:17  叫我大表哥  阅读(645)  评论(0编辑  收藏  举报