[SOLVED] executeCommandLine / curl

Hi all,

I cannot figure out what the problem is with this… I would like to execute a command, which works in linux cli. I want curl to open an URL and save the output to a .png file. Seems to be very simple, but nothing happens… Anyone knows what I should modify?

executeCommandLine("/usr/bin/curl \"http://192.168.1.2:3000/render/d-solo/OYhGUWmgk/homerseklet?from=now/d&orgId=1&panelId=2&width=1000&height=500&tz=Europe%2FBudapest&/$unit\" -o /etc/openhab2/html/grafikonok/homerseklet/napi/homerseklet_mai.png")

Thanks a lot!
Levente

Try

results = executeCommandLine("/usr/bin/curl \"http://192.168.1.2:3000/render/d-solo/OYhGUWmgk/homerseklet?from=now/d&orgId=1&panelId=2&width=1000&height=500&tz=Europe%2FBudapest&/$unit\" -o /etc/openhab2/html/grafikonok/homerseklet/napi/homerseklet_mai.png")
logInfo("exectest". "results: " + results)

Or put your long intruction inside a bash scrpit and call the script

2019-11-03 00:15:00.452 [INFO ] [ipse.smarthome.model.script.exectest] - results: null

Oooh, I forgot the timeout (see end of exec params)

results = executeCommandLine("/usr/bin/curl \"http://192.168.1.2:3000/render/d-solo/OYhGUWmgk/homerseklet?from=now/d&orgId=1&panelId=2&width=1000&height=500&tz=Europe%2FBudapest&/$unit\" -o /etc/openhab2/html/grafikonok/homerseklet/napi/homerseklet_mai.png")
logInfo("exectest". "results: " + results , 10000)

Oh, this was a typical beginner question… :frowning:
As far as I am not so good at linux administration, of course the problem was caused by the permissions:
drwxrwxr-x+ 4 openhabian openhabian 4096 Nov 1 22:23 grafikonok

openhab user did not have permission to write in this directory.
I had to have some sleep, and think about it :smiley:

If someone finds this topic with a similar issue, the solution is to change the owner of the directory with this command (from linux cli):

chown -R openhab:openhabian /etc/openhab2/html/grafikonok/

Br,
Levente