Trying to execute a script inside Octoprint

What is the problem?

I am trying to create a batch file to set gpio pin high (which will turn off power to the printer. I am putting the batch file (name in the Octoprint Settings->Octoprint->Server->-Shutdown System, but the batch file never gets executed.
The (in my home directory) file contains:

raspi-gpio set 27 op
raspi-gpio set 27 dh
sudo shutdown -h now

And I created it with nano on the Pi.

What did you already try to solve it?

  1. Manually ran (which is in my home directory), and it worked fine.
  2. Tried various combinations of in the Shutdown System field, but nothing worked.

I am a complete newbe on Linux. This used to work many years ago, and I rebuilt the Octoprint box to incorporate the Pi 7" touchscreen (so I could have local control over the printer), and now it doesn't work.

Have you tried running in safe mode?


Did running in safe mode solve the problem?

No. Batch file never got executed.

Systeminfo Bundle

You can download this in OctoPrint's System Information dialog ... no bundle, no support!) (44.5 KB)

Additional information about your setup

Octoprint on a Pi4B with 7" touch screen and custom hat. Driving the Pi with a 24V power supply with a buck converter 24V->5V. Printer is Prusa MK4 GPIO pin 27 drives the reset (through a relay on the hat-the relay is driven by a darlington transistor) on a high-power latching relay which cuts off power after 20 seconds to the Pi and the printer.


make sure you are doing full path to the file.


That didn't work. Script never executed.

curious if you did chmod +x to make the script executable?

Of course. Didn't help.

CHMod 777 /full path/

I had the incorrect path to in the shutdown field.

1 Like