crontab命令——激活虚拟环境后再执行脚本
问题:使用crontab命令执行定时脚本时,需要先激活虚拟环境
命令(2种):
# 方法1:
* * * * * source /mnt/py3/bin/activate;python /mnt/test/test.py >> /mnt/test/test.log 2>&1 &
# 方法2: * 16 * * * cd /Users/admin/whl_work/toufang_local/ && ./venv/bin/python app_oversea_fb/fb_sycn_to_odps.py >> /Users/admin/whl_work/log/fb_odps.log
方法1(未验证)参考自:https://blog.csdn.net/weixin_42692597/article/details/105053278