Help Sending a curl request (UPDATE KODI)

Is this something I will need too change user for?

When I access my rpi over ssh I use the user openhabian will I need to log out and log back in as root or openhab?

I have ran those commands as sudo no result hence do I need too log out or something

You cannot log in as root.

You cannot log in a openhab.

Both are special limited account that do not allow one to login. You have to ask permission to run commands as either of these users. That is what sudo is for.

sudo ls means “run the ls command as user root”. Sudo will then as for your password and if your user is allowed to run ls as root it will run the command as root.

When these commands are successful they don’t generate any result. But when you look at the file you should see that it is now owned by openhab and has execute permissions.

Thanks for that i was unsure as i had a feeling it would work this time so i thought maby i needed to be a different user newbie linux thing i suppose

After running the commands as you said i did not get a confrimation of any changes

trying to edit the Kodi_rescan.sh file after permission channge in windows from the smb share now fails get popup

admin


pressing the switch that fires the script returns error

2018-08-02 19:31:13.427 [ome.event.ItemCommandEvent] - Item 'Kodi_Rescan' received command ON

==> /var/log/openhab2/openhab.log <==

2018-08-02 19:31:13.488 [WARN ] [lipse.smarthome.io.net.exec.ExecUtil] - Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "/home/openhabian/Kodi_rescan.sh" (in directory "."): error=2, No such file or directory)

I’m starting too feel out of my depth here but hopefully soon it will get cracked and i will have learned new stuff

This is a problem. Don’t change the group ownership, otherwise the user openhabian (which is member of the group openhabian) can’t access his files anymore.

Please revert via:

sudo chown openhab:openhabian kodi_rescan.sh

Now your file isn’t there, where you told openHAB.

“No such file or directory”

I have tried your command too still getting the

2018-08-02 19:52:52.199 [WARN ] [lipse.smarthome.io.net.exec.ExecUtil] - Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "/home/openhabian/Kodi_rescan.sh" (in directory "."): error=2, No such file or directory)

the file is located there

running command sudo find / -name Kodi_rescan.sh returns

/home/openhabian/Kodi_rescan.sh

That’s not what my command was about, it was about the ability to read it with windows tools. (Samba is configured with user openhabian)

The problem is in your rule, the executeCommandLine is wrong.

Thanks for your input

I still cant edit the file from windows i can before running any permission commands its not much of a problem not being able too edit the file aslong as it runs i will look at my rule again

Please try:

ls -lisa /home/openhabian/Kodi_rescan.sh

and show the output.

979 4 -rwx--x--x 1 openhab openhabian 217 Aug  2 19:51 /home/openhabian/Kodi_rescan.sh

now:

sudo chmod 775  /home/openhabian/Kodi_rescan.sh

no response from command line file now editable with windows again

so whats wrong with my rule it looks fine too me others have said it still works too

rule "Kodi Video Library Scan"
when
	Item Kodi_Rescan received command
then
	val result = executeCommandLine("/home/openhabian/Kodi_rescan.sh", 5000)  

	logInfo("Kodi Library Scan", result)
end

Try again now.

If that doesn’t work, please show the output of

ls -lisa /home/openhabian/Kodi_rescan.sh

still says no such file

output

979 4 -rwxrwxr-x 1 openhab openhabian 217 Aug  2 19:51 /home/openhabian/Kodi_rescan.sh

Hmm.

could you copy your script and the call to the scripts folder? Maybe some additional restriction because of user home directory?

sudo cp -p /home/openhabian/Kodi_rescan.sh /etc/openhab2/scripts

And adjust your execution accordingly.

i get even worse results when putting it in that folder i have tried allready but for the sake of arguments i will try again …

same result

2018-08-02 20:19:40.240 [WARN ] [lipse.smarthome.io.net.exec.ExecUtil] - Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "/etc/openhab2/scripts/Kodi_rescan.sh" (in directory "."): error=2, No such file or directory)

edited rule too

rule "Kodi Video Library Scan"
when
	Item Kodi_Rescan received command
then
	val result = executeCommandLine("/etc/openhab2/scripts/Kodi_rescan.sh", 5000)  
	logInfo("Kodi Library Scan", result)
end

my head is starting too hurt from all the banging on the wall lol

You tried with wrong permissions, so your try was worthless.

Thats a good point :wink: doi need too run commands again or do they copy over with the file

That’s the -p for, this copies all attributes (preserve attributes).

But please check with

ls -lisa /etc/openhab2/scripts

@job
Lisa says

128000 4 -rwxrwxr-x 1 openhab openhabian 217 Aug  2 19:51 /etc/openhab2/scripts/Kodi_rescan.sh
[20:27:08] openhabian@openHABianPi:~$ ls -lisa /etc/openhab2/scripts
total 16
132872 4 drwxrwxr-x+  2 openhab openhabian 4096 Aug  2 20:18 .
132849 4 drwxrwxr-x+ 13 openhab openhabian 4096 Jul  2 23:10 ..
128000 4 -rwxrwxr-x   1 openhab openhabian  217 Aug  2 19:51 Kodi_rescan.sh
132873 4 -rw-rw-r--   1 openhab openhabian  236 May 28 09:33 readme.txt

Try that:

sudo runuser -l openhab -c '/etc/openhab2/scripts/Kodi_rescan.sh'