Raspberry Pi remote shutdown via batch file

I have a confession to make: I’ve got myself a simpit¹. And though its not really a ham radio topic I do want to share some of my work around it with a wider audience (and not start another custom blog for my simpit-related activities which may or may not become obsolete in a couple of years time).

One of the elements of my simpit is a custom CNC-milled panel containing four pieces of 800×800 round TFT displays, each connected to a Raspberry Pi 5 with a POE+ HAT. Sim Innovations Air Manager and four instances of Air Player are used to show various flight instruments on those displays.

A PoE switch is providing both power and connectivity to each of the four Raspberry Pi’s driving the displays.

All Raspberry Pis boot up nicely as soon as they are supplied with power. However, there is no clean way to shut down, as there are no user interfaces such as keyboard or mouse connected to those Raspberry’s. Manually logging in and shutting down every Raspberry Pi is cumbersome and not really you want to do every time I am done with playing a flight sim.

Thankfully, there is a solution which works for Windows and can be executed in a one-click manner: The creation of a custom batch file (i.e. „shutdown_raspi.bat“) which utilizes a tool called PLink that’s part of the PuTTY tools, likely already familiar to anyone with a Windows computer working with a Raspberry Pi.

@ECHO OFF
plink.exe -ssh pi@192.168.8.191 -pw raspberry sudo shutdown now
plink.exe -ssh pi@192.168.8.192 -pw raspberry sudo shutdown now
plink.exe -ssh pi@192.168.8.193 -pw raspberry sudo shutdown now
plink.exe -ssh pi@192.168.8.194 -pw raspberry sudo shutdown now

The structure of this file should be fairly self-explanatory and I leave adaption to one’s specific needs and circumstances in the hands of the capable reader.

¹ Simpit – „An environment designed to replicate a vehicle cockpit.“

Leave a Reply