I want to host my own onion website on my raspberry pi. I managed to get it setup and it worked perfectly. However, I do not want to keep my Pi running all the time. I would like to turn it off overnight or if I do not want my website running. Will this hurt the Raspberry Pi? If I power my Pi back up from a shutdown, how do I get my website up and running again?
it's a linux computer ... do a proper shutdown before powering off, same as any other computer– jsotolaDec 15, 2022 at 17:40
I know how to shutdown the Pi I'm wondering how shutting it down will effect the onion website that I am hosting.– LDM31Dec 15, 2022 at 17:41
that is a different question from your post– jsotolaDec 16, 2022 at 7:23
from the hardware point of view, it won't cause any issues, the most crucial part of having in mind is that sdcards are formatted with specific filesystems ext3 and ext4 depending on the partition.
Filesystems like those ones will use journals, metadata, and internal structures to keep your information secure and consistent, stuffs like these work at a kernel space, and applications use the filesystem in user space as a virtual filesystem or VFS, to be able to store the application properly on the hardware could take time (maybe too little for us to realize) but if you interrupt that in the middle you can have data corruption, also because file descriptor won't have the time to close on a hard power-off (like just disconnecting the power supply).
The mounting process triggered in boot time will trigger a filesystem check, maybe it can fix it, maybe it won't, depending on the damage to the filesystem, or maybe it will request user intervention and you will need to connect a display and keyboard to fix this.
Back to the main question, the correct way to turn off any server will be to power it down from the operating system, you can run a sudo shutdown -h now and that will stop all the units and services the proper way, will close file descriptors, safely umount the filesystem, stop talking to the hardware and at the end invoke de power off of the board.
To start your services at boot time, add the units to start on boot time, you can use the systemctl command-line utility for controlling the systemd system and service manager.
I hope this helps. =)