Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
edster99 opened this issue Jul 16, 2020 · 7 comments

Comments

@edster99
Copy link

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

@kantlivelong
Copy link
Owner

I'm unable to reproduce this. Need logs.

@edster99
Copy link
Author

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

@edster99
Copy link
Author

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

@edster99
Copy link
Author

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.

@ruedli
Copy link

ruedli commented Apr 28, 2024

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.

@turkishfilms
Copy link

my OCTO10 gcode command is /usr/local/bin/co.sh the co.sh file is:
#!/bin/sh
echo hello
i get error 127 when i run it.
when i run OCTO50 echo pwd i get ok. but nothing shows up in any logs
i eventually want to be able to control my Pi's PWM port 15 5kHZ so i can trun my laser off and on so the engraving letters arent connected

@turkishfilms
Copy link

ive been trying for hours and i cant get it to work. So frustrating

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants