PROBLEM bash script does not start (ruby?)

All kinds of 'OS' scripts

Moderator: leecollings

Post Reply
vrega
Posts: 15
Joined: Wednesday 13 December 2017 10:12
Target OS: Linux
Domoticz version:
Contact:

PROBLEM bash script does not start (ruby?)

Post by vrega »

Hi all,
i'm trying to use a bash script to start a command.
I've associated the script to a dummy switch.
The log is ok, it seems that the script is correctly executed but the command inside the script is not executed.
When i execute the .sh script from command line it's ok.
This is the script:

#!/bin/bash
/home/pi/.rvm/gems/ruby-2.5.1/bin/midea-ac set xxxx --power=off > /dev/null &

if i remove the & at the end of the script, i see error 32512 in the log.

As you can see it's very simple but it does not work. The command i execute is the midea-ac ruby package that i've installed following the instructions from here:

https://github.com/yitsushi/midea-air-condition

Is it related to ruby permissions from Domoticz?
Can you help me?

Regards,

vrega
vrega
Posts: 15
Joined: Wednesday 13 December 2017 10:12
Target OS: Linux
Domoticz version:
Contact:

Re: PROBLEM bash script does not start (ruby?)

Post by vrega »

I've found that the problem is that the script is executed as root and not as user pi (the default raspberry user).
If i execute the script as root, it gives me the error:

/usr/bin/env: ‘ruby’: No such file or directory

If i execute the script as user pi all is ok.
Is there a way to force domoticz to execute the script as user pi or is there a way to make it work with user root?

Thank you
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest