Walt Rarus writes:

> I have a java (clojure, actually) program which is invoked via a bash
> script. When the script is invoked from the shell, the java program
> always runs and succeeds. However, when the script is invoked via a
> cron job, the java program always runs and crashes with a null pointer
> exception.

Cron jobs have a limited environment. The $PATH is shorter, many 
environment variables are not set. Maybe this is the cause?

> Any thoughts on how to debug the situation?

I would add "env > /tmp/myscript.env" to the top of the script, this puts 
all environment variables and their values into /tmp/myscript.env. Compare 
the outputs with diff, maybe you spot something which explains the 
behaviour.

Maybe you can replace the call to the script in your crontab with 
something like "bash -il /path/to/myscript", forcing it to run in an 
interactive login shell. I have not tried this, though, it's just an idea.

        Wonko

Reply via email to