The 'which' command returns nothing via cron, but works via console

Posted by Zárate on Super User See other posts from Super User or by Zárate
Published on 2010-04-26T21:52:00Z Indexed on 2010/04/26 22:14 UTC
Read the original article Hit count: 242

Filed under:
|
|
|

Hi there,

I've written a little utility in haXe + Neko that needs to execute some GIT commands. To avoid hardcoding the path to the GIT executable I'd like to use the which command to find out where it is. Everything works as expected when running manually from the console, but not when the the app runs on a cron job.

I'm aware of the restricted environment (here or here) when you run a script using cron, but still surprised this doesn't work:

/usr/bin/which git >> /home/user/git.txt

The text file is created but the content is empty. Again, when run from the console it works as expected.

Any ideas? I'm running OS X Leopard, if that helps.

Thanks : )

Juan

© Super User or respective owner

Related posts about cron

Related posts about which