Sh script problem

What is the problem?

  • .sh script for light does not work in Octoprint . Im new to Octoprint.

What did you already try to solve it?
i tried the system command editor and custom control editor but am i doing something wrong?
I can call the script in /home/pi/ with "bash" via an SSH connection and it works too(can turn it on or off).

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, what kind of hardware precisely, ...)
OctoPrint 1.4.2
Python 2.7.16
OctoPi 0.17.0

my script looks like this:

gpio mode 24 out

if [ $(gpio read 24) = 0 ]
gpio write 24 1
gpio write 24 0

Try specifying the full command to bash - /bin/bash rather than just bash. Not sure how the custom controls are running, but I have found cases this is needed.

does not work that way either. I've tried different spellings.If I try it via the system command editor, it doesn't matter what I do, the same error occurs.

404 Not Found

Not Found

The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

afaik you may not actually need to specify /bin/bash or bash for the script.

Make sure the script file is executable with chmod +x /home/pi/

The execution should then work just fine.

If it still doesn't work, it could be a user permissions issue - maybe OctoPrint is trying to run it as a user that isn't pi? In that case you may need to look into setting up sudo to not check a password for that script. Look at this Ubuntu sudoers thread for how best to set that up.

1 Like

... same problem I have. I tried different combinations but no response on pressing the key...
my scripts are working, as I also included them into the config.yaml as system buttons (fully working).

Within the Command plugin I used combinations like:
bash /user/local/
sudo bash /user/local/
sudo bin/bash /user/local/

(I also did this with a phyton script - same result ..)

Whats wrong here ?

Custom Control Editor v0.2.2
Octoprint v1.52 / OctoPi v0.17.0 running on Pi3B

Where is the script located? /user/local/ doesn't exist on OctoPi, unless you have created it (in which case, I suggest instead of creating things at root create them in your home directory, /home/pi)