Most Raspberry Pis are used for a dedicated purpose, for a specific tool.
The setup may well be headless, without a monitor, keyboard, or mouse.
To shut down these Pis, unplugging the power is not recommended.
It will result in a corrupted microSD card, sooner or later.
Headless Raspberry Pis need to be shut down remotely.
A few simple commands will accomplish the task.
you could use SSH or VNC to shut down Pis remotely, depending on the OS.
VNC Server by RealVNC is already built into Raspberry Pi OS; you oughta enable it, though.
Navigate toMenu > Preferences > Raspberry Pi Configuration.
In theInterfacestab, toggle the VNC option to on and reboot the Pi.
VNC Server should start automatically at the next boot.
Shut Down Raspberry Pi Remotely Via SSH
Install SSH, andconnect to the Raspberry Pi using SSH.
By doing so, the Pi stays up-to-date with security patches.
get in to your router, find the port forwarding option, and set it up.
The internal and external ports are 22; the IP address is that of your Pi.
Once done, you could connect to the Pi using its public IP address.
Then, issue theshutdowncommand, as you would do from your gear on a local data pipe.
One way to get around this is by using a high-capacity power bank as the power source.
Raspberry Pi consumes little power and so can run for a long time using a power bank.
The latter should automatically shut off when the power draw is less than 30mA.
So, after you grab shut down the Pi, the power bank will auto-shutoff.
However, you do need to double-check it shuts down correctly to avoid possible corruption of its SD card.
It’s also advisable to back up the data from the card, just in case.