git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [OT?] Executing Git from bash script invoked by cron

From
MWMarc 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
Previous: Sverre RabbelierNext: Sverre Rabbelier
Message 3 of 7 in “[OT?] Executing Git from bash script invoked by cron”
  1. Johannes SchneiderJun 28, 2010
  2. Sverre RabbelierJun 28, 2010
  3. Marc WeberJun 28, 2010
  4. Sverre RabbelierJun 28, 2010
  5. Johannes SchneiderJul 3, 2010
  6. Ramkumar RamachandraJun 28, 2010
  7. Matthieu MoyJun 29, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.