Exec not working since update to 2.5

Hi everyone hope you all have a nice new year :slight_smile:

System: Ubuntu Server 18.04.3 LTS VM (HYPER-V) running openhabian 2.5

I recently updated from 2.4 to 2.5 most things seem too have gone smoothly but I have a few exec commands that no longer run and are stuck at uninitialized anyone else had this issue?

after the update i was running exec binding 2.5 i have also tried the legacy .1 binding

Capture

The 3 clean commands are the same just for different kodi machines same for the update commands

// Kodi Libary Things
    // HTPC2
Thing exec:command:kodidbupdate "Database Update" @ "Living Room" [command="/usr/bin/curl -XPOST --data-binary {\"jsonrpc\":\"2.0\",\"method\":\"VideoLibrary.Scan\",\"id\":\"mybash\"} -H content-type:application/json http://USER:PASSWORD@192.168.0.15:8080/jsonrpc > NUL 2>&1", interval=0 , timeout=5, autorun=false]
Thing exec:command:kodidbclean "Database Clean" @ "Living Room" [command="/usr/bin/curl -XPOST --data-binary {\"jsonrpc\":\"2.0\",\"method\":\"VideoLibrary.Clean\",\"id\":\"mybash\"} -H content-type:application/json http://USER:PASSWORD@192.168.0.15:8080/jsonrpc > NUL 2>&1", interval=0 , timeout=5, autorun=false]

Do those cURL commands run normally ad the openhab user leaving off the output redirects? The second redirect especially will mask any errors.

Hi @Bruce_Osborne thanks for a reply

I’m not sure exactly what you mean as i’m not very good at curl commands etc could you send me what you would like me too run ? I didn’t write these commands someone else here did it for me quite awhile

do you mean run this part only ?

curl -XPOST --data-binary {\"jsonrpc\":\"2.0\",\"method\":\"VideoLibrary.Scan\",\"id\":\"mybash\"} -H content-type:application/json http://USER:PASSWORD@192.168.0.15:8080/jsonrpc > NUL 2>&1"
1 Like

I mean

>NUL
redirects the normal response output to no where.

2>&1
redirects any errors to the same place.

Another option might be to just remove the 2>&1 and see what errors are produced.

Apparently you copied a command from somebody without understanding how it functions. We try here to educate so you understand your system operations.

Hi again @Bruce_Osborne

sorry its taken so long too reply i have been busy

I didn’t just copy code randomly, I was talking too someone and they helped me out and sent it too me.

I thought I knew what I needed too know, that it sent a request too the kodi machines API as it was all working fine since I first used it I didn’t think I needed too know anything else about this

Without 2>&1

[19:09:47] sharpy@openhabian:~$ /usr/bin/curl -XPOST --data-binary {\"jsonrpc\":\"2.0\",\"method\":\"VideoLibrary.Scan\",\"id\":\"mybash\"} -H content-type:application/json http://USER:PASS@192.168.0.15:8080/jsonrpc > NUL
curl: (3) Port number ended with '"'
curl: (3) Port number ended with '"'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    91  100    76  100    15  15200   3000 --:--:-- --:--:-- --:--:-- 18200

Without NUL 2>&1

[19:14:59] sharpy@openhabian:~$ /usr/bin/curl -XPOST --data-binary {\"jsonrpc\":\"2.0\",\"method\":\"VideoLibrary.Scan\",\"id\":\"mybash\"} -H content-type:application/json http://USER:PASS@192.168.0.15:8080/jsonrpc
curl: (3) Port number ended with '"'
curl: (3) Port number ended with '"'

For validating JSON I find this site useful.

1 Like

I’m using exec v2 for lightwavev2 api (scripts and curl) and I have no issues since I upgraded to 2.5 last week

1 Like

It should start with /usr/bin/curl -X POST --data... Note the space after the -X

1 Like

@Bruce_Osborne I did at the site you sent me didn’t have a clue what too change but i will save it for future reference…

Thanks for that tip too add the space changing my exec things (adding the space) brings them back online.

so what happened they were working without the space before the update to 2.5 did something change in 2.5?

was it always wrong and 2.4 just dealt with it without the space ?

i can’t test if it is actually running atm my GF is watching the tv connected too kodi and my kids are asleep don’t want too wake them turning on there tvs the film she is watching has nearly finished i will run them then and report back

@delid4ve

Thanks for that i wasn’t sure if there was a problem with the 2.5 binding but they are online now

If you search for the ‘lightwave binding updated’ thread and look at all the files I’ve posted up there’s so many exec configs in them if you get stuck.

Ps. A lot of them are double escaped where I was creating files from the rule files, just strip the extra // and /‘ out of them

1 Like

This doesn’t work on my system, has to be curl only

it has always worked on my system but i only use it too modify the kodi library i’m about too test now

@Bruce_Osborne yes i have just tested this brought the items back online and now updates the library successfully thanks fo your help on that really appreciate it i would not have worked that out if i’m being honest

The curl command has always required the space.after that command switch.

X/–request

(HTTP) Specifies a custom request method to use when communicating with the HTTP server. The specified request will be used instead of the method otherwise used (which defaults to GET). Read the HTTP 1.1 specification for details and explanations. Common additional HTTP requests include PUT and DELETE, but related technologies like WebDAV offers PROPFIND, COPY, MOVE and more.

From the man pages (documentation) for that command. https://linux.die.net/man/1/curl

It is always recommended to specify the full command path in a script. Perhaps your curl command is located some place else.
To figure out where the command is you could type which curl or whereis curl.

1 Like

Just /sbin/curl
The way in which I used it though was for others to be able to integrate lightwave so just went with curl as would have broke on different systems

1 Like

That is dependent on the path in your user environment though. Most of the time the path an automated script environment is different. That is why it is best practice to use full paths.
There is a way in a script to search the environment for a path but it is always possible that program is not in the path.