fetch_commits problem with cron

Added by Adam Knight over 9 years ago

If I run the CLI command to call Repository.fetch_commits in a shell, it works perfectly. If I put it in cron, nothing happens.

I've verified cron is running, so that's not the problem. I've su-ed to the www user and run it and it works fine (that is, issues pick up the changesets that mention it). But when running cron, nada.

Any ideas on what environment variables are needed that may not be set, or other workarounds here? I'm using the following in cron:

* * * * * /opt/local/bin/ruby /Library/WebServer/redmine/script/runner "Repository.fetch_changesets" -e production 2>&1 >> ~www/cron.out

cron.out is always empty.

Replies (1)

RE: fetch_commits problem with cron - Added by Adam Knight over 9 years ago

Never mind me. As always seconds after I post I see the problem. cron isn't setting the PATH up correctly. I created the following shell script and have cron call it instead to make it run properly:

#!/bin/bash
PATH=/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:$PATH
cd /Library/WebServer/redmine
ruby script/runner "Repository.fetch_changesets" -e production

(1-1/1)