crontab 启动supervisor爬虫

crontab 

crontab -e
17 10 * * Mon,Tue,Wed,Thu /home/restart_supervisor.sh

执行权限

cd /home
chmod +x restart_supervisor.sh

 restart_supervisor.sh

#!/bin/sh
export PATH=$PATH:/usr/local/python3/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/node-v8.11.4/bin:/root/bin:   # 通过$PATH获取
cd /www/app_store_spider/   # 进入虚拟环境目录
pipenv shell  # 激活pipenv
kill -9 `ps -ef |grep python|awk '{print $2}' `&&unlink /*/*/supervisor.sock && sleep 3 && supervisord -c /etc/supervisord.conf  # 执行命令

 

posted @ 2020-09-19 11:08  洛丶丶丶  阅读(227)  评论(0编辑  收藏  举报