Answer the question
In order to leave comments, you need to log in
How to set up cron, gsutil and subrocess?
Can't run command via cron
gsutil cp /home/ubuntu/data.json gs://project/data.json
which in turn is run through subprocess.$ crontab -e
*/1 * * * * /usr/bin/python /home/ubuntu/ex.py > home/ubuntu/cronlog.txt 2>&1 >/dev/null 2>&1
from subprocess import call
PATH="/home/ubuntu/lib/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
BOTO_CONFIG="/home/ubuntu/.config/gcloud/legacy_credentials/email/.boto"
call('gsutil cp /home/ubuntu/data.json gs://project/data.json', shell=True)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question