Error in EXEC node

#1

Just discovered NODE-RED and still learning the basics...
Hardware is Raspberry Pi.

Designed a flow, with a few exec nodes.
Works perfectly on Rpi/Raspbian, commands work in Terminal.

Now I want to run the flow on another Rpi.
This one has OSMC/Kodi. (Linux osmc 4.14.34-6-osmc)
Installed Node-Red without problems, imported flow without problems, only the exec nodes return an error.
Commands are working if I connect with ssh.
Tried different simple commands, tried adding sudo, same error:
"Command failed: sudo ls 1544782951140 ls: cannot access '1544782951140': No such file or directory"

Any ideas, anyone ?

0 Likes

#2

You shouldn’t be able to use sudo in an exec node as it would be an escalation of privileges.

You are trying to list the contents of a directory and the error message is telling you it doesn’t exist

So check it does exist
Try with the full path to the directory
Check that the user you are running node-red as has access

0 Likes

#3

That looks very much like you have the append msg.payload option still ticked in the Exec node - so the timestamp from an Inject node is being appended to the command. Untick that box in the Exec node and try again.

0 Likes

#4

In addition to @ukmoose's comments it looks as if you are trying to use a timestamp as a parameter to the exec node. Perhaps you are triggering it with an inject node and have got the 'Add msg.payload to command' option ticked.

0 Likes

#5

Thanks for the quick reaction !
ukmoose was wright !
I gave my user root permissions.
Problem solved !!

Thank for the help...

0 Likes

#6

Glad you got it working, but you really shouldn’t have to use root to list a directory.

Perhaps if you could explain what you are trying to do we can suggest a better way of achieving it

0 Likes

#7

@knolleary Of course you are right, stupid of me, forgot to uncheck this for my example...but this wasn't really the problem...I think.

@ukmoose
This Rpi runs OSMC showing an info-clip continuously on a TV.
Next to that it has node-sonos-http-api, which is an Sonos-server listening on port 5005.
A camera with motion detection makes the sonos system welcome people coming in with tts.
This all works fine.
Now, next to all that I installed Node-Red with the intention of checking if everything is running like it should.
For example I send a HTTP request to the sonos server to see if it's up and running. If not (ECONREFUSED) I try to start it by way of the EXEC node running : bash ~/node-sonos-http-api/st.sh.
An executable script.
Of course you are right, I shouldn't have to use root.

0 Likes