Score:0

Cron job doesn't run script python in the specific directory

nl flag

I created a simple python script to add, commit, and push all files in some directory. I want to do this daily by a scheduled cron job. But unfortunately, the script doesn't run. Before this, I do some research on how to check activities in my Ubuntu, and I see my cron job has been executed. So I was confused why the script doesn't run.

This is my cron job:

16 16 * * * cd ~/Desktop/Journey\ to\ Go/ && python auto-push.py

This is my python script:

import os
os.system('git add .')
os.system('git commit -m "auto push"')
os.system('git push')
Score:1
cn flag

The reason is the ~ as cron does not expand it to the path of your home directory like an interactive shell does. Please use full paths.

cn flag
so who is the person that does not agree with this? the ~ is the problem...
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.