OctoPrint-GCodeSystemCommands icon indicating copy to clipboard operation
OctoPrint-GCodeSystemCommands copied to clipboard

Requirement to explicitly call sh to execute shell script : should be in config description

Open edster99 opened this issue 4 years ago • 7 comments

What were you doing?

Wanted to execute code

Iniital error was a 'returned 127' resolved by adding absolute path to the shell script /home/pi/OctoPrint/OCTO100.sh (execution properties set to all) Then got an error 2 resolved by adding sh in the gcode system commands to give sh /home/pi/OctoPrint/OCTO100.sh This then executed successfully.

Version of OctoPrint-GCodeSystemCommands

1.0.1

Operating System running OctoPrint

Raspbian 10 buster Octoprint 1.4.0 Octopi 0.17.0 Python 3.7.3

Printer moprodel & used firmware incl. version

Link to octoprint.log with octoprnt.plugins.gcodesystemcommands set to DEBUG

edster99 avatar Jul 16 '20 22:07 edster99

I'm unable to reproduce this. Need logs.

kantlivelong avatar Jul 16 '20 22:07 kantlivelong

I'll create them in the morning after 'unfixing :)'

edster99 avatar Jul 16 '20 22:07 edster99

octoprint.log This is the log where I have the path defined, but not explicitly calling the script using sh.

edster99 avatar Jul 17 '20 07:07 edster99

No path no sh This is what you get with the default creation of the command returned in the terminal. I will withdraw my request about the full path as you have that implicitly referred to in some of the screen shots.

edster99 avatar Jul 17 '20 08:07 edster99

I just added a shell script to run. I did three things:

  • I placed the file in a location of my PATH envirronment variable, I used /usr/local/bin
  • I made sure the firstline had a shebang line, I used #!/bin/sh
  • I made the file executable: chmod +x commandfile

This worked OK, I did NOT have to give it a .sh extension (running octoprint ubuntu server, using dietpi) I did NOT have to add a path to the command I did not need to put /bin/sh in front of the command

Could it be one of these three things I did was forgotten by @edster99 ?

image

OCTO10 executed the script in /usr/local/bin/light (and switched of the light in my enclosre through homeassistant with nodeRed

image

So.... I cannot confirm a bug.

ruedli avatar Apr 28 '24 16:04 ruedli