在Linux写shell脚本,执行python指令

需求现状:需要写一个脚本,脚本内封装了一些python脚本调用

示例说明:要在Linux平台写一个shell脚本,然后crontab定时调用。脚本内容是执行scrapy爬虫

#!/bin/sh
source /etc/profile
source ~/.bash_profile
cd /www/abc/python/video && scrapy crawl haha

source /etc/profile和source ~/.bash_profile目的是为了引入环境变量。否则会出现手动执行脚本没问题,但是定时任务就是不执行的情况

猜你喜欢

转载自www.cnblogs.com/yoyowin/p/12175887.html
今日推荐