1

I'm trying to run a scheduled cron job using a crontab from a linux box where I'd run the command git svn fetch on a periodic basis.

here is what my crontab looks like:

  1 #!/bin/bash
  2 PATH="/usr/local:/usr/local/bin:/bin"
  3 HOME="/home/person1/src"
  4
  5 * * * * * /home/person1/src/autofetch.sh
  6 0 9,13,17 * * 1-5 /home/person1/src/autofetch.sh

My autofetch.sh simply has the command: "git svn fetch"

I think I'm getting close because it found the git command and the fact that it is able to run in an environment that can use git. I originally had problems where it would say:

Already at toplevel, but .git not found

But now I'm getting a weird authentication error sent to my linux mailbox:

X-Cron-Env: <PATH=/usr/local:/usr/local/bin:/bin>
X-Cron-Env: <HOME=/home/person1/src>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <LOGNAME=person1>
X-Cron-Env: <USER=person1>

Authentication realm: <http://subversion.server1.com:80> Subversion repository
Password for 'person1':
Authentication realm: <http://subversion.server1.com:80> Subversion repository
Username: Use of uninitialized value in chomp at /usr/local/libexec/git-core/git-svn   line 4322.
error: git-svn died of signal 11

anyone know what to do? Or ran scheduled git commands using crontab before?

Notes:

  • I have a git client running from a subversion server, which is where git-svn comes into play.
  • My git repository is in /home/person1/src
  • I can run "git svn fetch" from the terminal only as long as I am in the /home/person1/src directory
sksallaj
  • 3,872
  • 3
  • 37
  • 58

1 Answers1

1

You probably don't want to set your HOME to /home/person1/src. svn uses $HOME to find its cached passwords, and it won't unless you set HOME to /home/person1. If you want to your cron to run in the src directory, just put a "cd $HOME/src" command at the top of the script.

srwalter
  • 111
  • 3
  • Thanks, I removed the HOME path, and removed the autofetch.sh to use: "cd src; git svn fetch" without the quotes, and it worked! Your answer gave me a clue to do that. I couldn't put the cd command at the top since it was erroring out after trying to save the crontab. – sksallaj Jul 24 '12 at 22:53