Hi

Hmm I wonder if its something with permission issue, eg run cron vs normal.

Camel uses the JDK api to get env variables from System.getenv, so you
can try some java code that does that and see if you can get those
from the cron job or not.

On Wed, Nov 13, 2019 at 8:54 PM Imran Raza Khan <imranrazak...@gmail.com> wrote:
>
> I have one jar file which contain camel route to run it from cron job i
> created shell script
>
> public void process(Exchange exchange) throws Exception
>     {
>         String host =
> exchange.getContext().resolvePropertyPlaceholders("{{env:HOSTNAME}}");
> }
>
> test.sh
> #!/bin/sh
> java -jar my.jar
>
> Now when i run
>
> sh test.sh it is able to access environment variable, but when i run from
> cron job it throw null pointer exception for  {{env:HOSTNAME}}
>
> Following is my cron
>
> cat > /etc/cron.d/reboot << EOF
> * * * * * root /usr/bin/flock -w 1 -E 0 /tmp -c /test.sh 2>&1 |
> /usr/bin/tee /dev/tty1
> EOF



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to