Rule Script bash not working as expected

I have a bash script that sets Openhab status on some items when launched outside openhab that is working fine

2015-10-06 10:10:52 - Active_Calling state updated to “201”
2015-10-06 10:10:52 - Active_Called state updated to “999”

When running as a rule

ule “Call”
when
Item Asterisk_Ring changed
then

      if(Asterisk_Ring.state == ON)
      {

     executeCommandLine("bash /etc/openhab/configurations/rules/call.sh")
      }

      if(Asterisk_Ring.state == OFF)
      {
    executeCommandLine(" bash /etc/openhab/configurations/rules/calloff.sh")
      }

end

2015-10-06 10:11:28 - Asterisk_Ring received command ON
2015-10-06 10:11:28 - Active_Calling state updated to
2015-10-06 10:11:28 - Active_Called state updated to

It is set to blank

curl command is as follows

curl --header ‘Content-Type: text/plain’ --request PUT --data “$numbercalling” “http://10.0.2.19:8080/rest/items/Active_Calling/state/

Why inside openhab does not set correctly and running outside it worked fine?

I get called /calling number from Asterisk and setting to an Item

BR

Openhab.log is normal and shows:

2015-10-06 10:11:28.588 [INFO ] [g.openhab.io.net.exec.ExecUtil] - executed commandLine ‘bash /etc/openhab/configurations/rules/call.sh’
2015-10-06 10:11:36.247 [INFO ] [g.openhab.io.net.exec.ExecUtil] - executed commandLine ’ bash /etc/openhab/configurations/rules/calloff.sh’

If your openhab and script is on the same machine could you maybe replace the IP with localhost?

e.g.

http://localhost:8080/rest/items/Active_Calling/state

I tried that but same issue

curl --header ‘Content-Type: text/plain’ --request PUT --data “$numbercalling” http://localhost:8080/rest/items/Active_Calling/state/
curl --header ‘Content-Type: text/plain’ --request PUT --data “$numbercalled” http://localhost:8080/rest/items/Active_Called/state/

2015-10-06 10:41:47 - Asterisk_Ring received command OFF
2015-10-06 10:41:48 - Active_Calling received command -
2015-10-06 10:41:48 - Active_Called received command -

Running outside

2015-10-06 10:43:24 - Active_Calling state updated to “201”
2015-10-06 10:43:24 - Active_Called state updated to “999”

Running outside openhab rules , script sets correctly data

Maybe i could do in other way?

Have you tried running openhab as root to check it’s not a permissions issue?

Yes. Its running as root

USER_AND_GROUP=root:root

have you tried piping the output of the bash script to a log file so you can see what’s happening when it’s triggered?