Allow admin to shutdown pi

Hi everyone,

I’m a relatively new user to NextcloudPi, but a long-time Raspberry Pi user. I’m setting up a NCP system for a (very) nontechnical friend, and I was wondering if there is some way that they can do a safe shutdown (sudo halt) of the Pi and NCP via the web interface. She’s on solar, so she’s very sensitive about things like power usage, and I just know she’ll be unplugging it probably regularly and I want to minimize the risk of storage corruption. Getting her to install and use a terminal window to ssh to the Pi, log in and do a shutdown command is something I’d like to avoid.

Thanks

John

If this is true she will risk ruining the data and nothing will prevent this. My suggestion is to not selfhost at all. Pay for a simple VPS and host your data on Vultr or Linode or Digital Ocean.

This sounds like a disaster. Nextcloud is not meant to be power cycled. Don’t even bother if that is what will happen. It’ll lead to conflicts and who knows what else. Just pay for a hosted account or a VPS.

Others thoughts…

What about automating this process yourself? You could write a simple ssh (passwordless) command and call it from a menu button: Shutdown NextcloudPi

Building this into NextcloudPi is actually not practical for all users.

You might also want to consider adding PoE to the device so it can be remotely turned on as well.

Thank you for the info. Can I ask what you’re referring to by ‘menu button’? As I said I’m not super familiar with NextCloud yet.

I don’t know the person’s setup you are referring to. So, a menu button on whatever computer they use.

Either way, skip selfhosting and just host it yourself for them on proper electricity or use a hosted service.

Thanks again for the recommendations. She doesn’t have internet service where she lives so this will be part of a self-hosted local network. I’ll take a look at some options for sending the shutdown command via some form of SSH options.

Create a script / batch file for her to double click on. Name it “Shutdown Pi” or whatever. Use these instructions to write the script:
https://www.shellhacks.com/ssh-execute-remote-command-script-linux/
Look into how to configure SSH with a key-pair, so she won’t need to enter the password:

Thanks everyone for the suggestions. I ended up going with an app on her phone that sends SSH commands and configured it to log into the pi and run ‘sudo halt’ to shut it down. I assumed that NC will correctly shut down when it receives the halt signal from the system

For remotely restarting the Pi you will need to add PoE, or power over ethernet, hat. You can purchase this for the pi as an accessory.

https://www.raspberrypi.com/products/poe-hat/

I also recommend using KDE Connect. It syncs device to device without internet by using wifi or bluetooth and can also sync between your phone to computer for files, messages, and other useful functionality.

Despite the name, you do not need either KDE or Linux to use it. :grin:

The final solution I came up with was to install Smart Command on her phone, configured a button in the app to send a ‘sudo halt’ command to the RPi, and installed one of those inline USB power switches. She presses the Smart Command button on her phone to shutdown the Nextcloud Pi, waits 10 seconds, then presses the button to power it off. When she wants to turn it back on she just presses the button again.

Thanks again for all of the suggestions.