简体   繁体   English

linux crontab 使用谷歌 api 驱动器失败

[英]linux crontab fails with google api drive

I have a python script that downloads files from google drive through the API, it's perfect to run it manually but when I want to automate it with crontab it doesn't download anything and it doesn't send errors to the log I defined.我有一个 python 脚本,它通过 API 从谷歌驱动器下载文件,手动运行它是完美的,但是当我想用 crontab 自动化它时,它不会下载任何东西,也不会向我定义的日志发送错误。 I am using absolute paths -> 05 20 * * * /usr/bin/python3 /home/user/etl1/download.py , also I have the headers configured in my script我正在使用绝对路径 -> 05 20 * * * /usr/bin/python3 /home/user/etl1/download.py ,我还在我的脚本中配置了标题

#! /usr/bin/python3
# - * - coding: utf-8 - * -

I have also given permissions to everything, but I can't.我也授予了所有权限,但我不能。 instead the Upload script that writes to BigQuery goes perfectly with crontab.相反,写入 BigQuery 的上传脚本与 crontab 完美搭配。

I would appreciate if someone could support me如果有人可以支持我,我将不胜感激

first of all - you have whitespaces in /usr /bin /python3 so you can try /usr/bin/python3首先- 你在/usr /bin /python3中有空格,所以你可以尝试/usr/bin/python3

and second , try:第二,尝试:

05 20 * * * $(which python3) /home/user/etl1/download.py >> ~/cron.log 2>&1

https://gavinwiener.medium.com/how-to-schedule-a-python-script-cron-job-dea6cbf69f4e https://gavinwiener.medium.com/how-to-schedule-a-python-script-cron-job-dea6cbf69f4e

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM