1 Star 0 Fork 0

Axin/spiders

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
crontab.sh 600 Bytes
一键复制 编辑 原始数据 按行查看 历史
Axin 提交于 2018-05-05 18:15 . 设置定时任务
# 这个文件执行会报错: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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/z429753211/spiders.git
git@gitee.com:z429753211/spiders.git
z429753211
spiders
spiders
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385