Re: [OT?] Executing Git from bash script invoked by cron
- From
- Marc Weber <marco-oweber@gmx.de>
- Date
- Jun 28, 2010, 21:17 UTC
- Message-ID
- <1277759597-sup-9397@nixos>
- In-Reply-To
- <4C290D88.80306@cedarsoft.com>
Excerpts from Johannes Schneider's message of Mon Jun 28 23:00:56 +0200 2010:
Show 14 quoted lines
> Hash: SHA1 > > Hi, > > I try to mirror my local git repository. > Therefore I created a bash script. This script, executed form the > command line, works fine. > > But the same script executed by cron, does not work. Git push does > simply nothing. No output, no push, nothing. > But git log and git --version works... > > I tried to google the problem, but couldn't not find anything useful. > Any hints are welcome.
What do you do in such cases? Make sure you log both: stdout and stderr.
a) sh -c 'your quoted command &> /tmp/logfile'
b) if this still does not work use strace:
sh -c 'strace -f-o /tmp/strace.log your quoted command &> /tmp/logfile'
Then you know how much is happening.
You may also want to check that the environment is the same. Eg export > file to create a file containing your environment. Then source it in the cron job line somehow.
I'm not using cron that often so the solution could be simpler.
Marc Weber