0

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
ImranRazaKhan
  • 1,955
  • 5
  • 33
  • 74

0 Answers0