Switching a Pi off

Raspberry Pi related support

Switching a Pi off

Postby ianhaynes » 28 Apr 2015, 12:15

Having used Rune with a Pi and IQAudio DAC as a lash-up for several weeks I want to put it in an enclosure and make it usable for the rest of the family. One issue seems to be that of switching it off carefully so the SD card doesn't get corrupted.

How have people done this? Any suggestions?
Pi 2, Ver. 0.5b, IQAudio DAC+
ianhaynes
 
Posts: 207
Joined: 04 Mar 2015, 12:51

Re: Switching a Pi off

Postby bevlar » 28 Apr 2015, 18:42

In RuneUI
Menu > Turn off > Power off

This halts the system so you can safety power down the pi.

Corruption should only occur if you pull the power while the system is running.
bevlar
 
Posts: 26
Joined: 16 Mar 2015, 10:52

Re: Switching a Pi off

Postby ianhaynes » 29 Apr 2015, 08:36

Yes but that's the point, other users aren't necessarily going to remember that. I'm looking for a foolproof way of shutting down. I'm aware of the Pi-Supply switch which aims to solve this but haven't been able to get it working with the Pi + IQAudio DAC.
Pi 2, Ver. 0.5b, IQAudio DAC+
ianhaynes
 
Posts: 207
Joined: 04 Mar 2015, 12:51

Re: Switching a Pi off

Postby bevlar » 29 Apr 2015, 09:03

Would other user turn off their PCs or laptops without shutting them down properly first?

The simplest solution to this problem is educating the users.

Other than that you would need something like MoPi. Its a ups board, you could script it the shutdown when it switches to battery. You would need to check the pin out though to make sure it won't interfere with your DAC.
bevlar
 
Posts: 26
Joined: 16 Mar 2015, 10:52

Re: Switching a Pi off

Postby mspohr » 29 Apr 2015, 17:14

I just leave it on all of the time. It takes so little power (just a few watts) that it's easiest to leave it on. Also, when I want to use it, I don't have to wait for it to boot. I have it stuck in the bottom of the stereo (ne AV) closet and just forget about it. I access it through one of several tablets.
mspohr
 
Posts: 5
Joined: 09 Mar 2015, 19:19

Re: Switching a Pi off

Postby neanderthaler » 01 May 2015, 08:43

I installed switch, resistors, led, python and the shutdown script from here:
http://www.forum-raspberrypi.de/Thread-tutorial-hoch-und-runterfahren-mittels-taster-incl-status-led
Needs to be adopted to archlinux: arch uses systemd instead of the debian sysvinit.
Works great, with no noticeable load on my slightly aged Pi B+.
I use an USB-DAC, but it should work with I2S-DACs as well. The relevant IOs are not used by iqaudio AFAIK.
If you are not afraid of playing around with linux, just give it a try!
Well worth it, IMHO.
neanderthaler
 
Posts: 22
Joined: 01 May 2015, 08:20

Re: Switching a Pi off

Postby ianhaynes » 01 May 2015, 09:02

Many thanks, looks to be a good solution.
Pi 2, Ver. 0.5b, IQAudio DAC+
ianhaynes
 
Posts: 207
Joined: 04 Mar 2015, 12:51

Re: Switching a Pi off

Postby bevlar » 01 May 2015, 10:00

You can use cron to start your script at boot/reboot

pacman -Syy cronie

EDITOR=nano crontab -e
@reboot /usr/bin/python /path/to/script.py &
bevlar
 
Posts: 26
Joined: 16 Mar 2015, 10:52

Re: Switching a Pi off

Postby neanderthaler » 01 May 2015, 17:47

Jepp, cron will do the job, too.
I for myself didn't like the idea to have an additional deamon running, even without noticeable load. Systemd is running anyway.
BTW, maybe it's necessary to remove "sudo" in the next to last line of "shutdown.py".
neanderthaler
 
Posts: 22
Joined: 01 May 2015, 08:20

Re: Switching a Pi off

Postby bevlar » 01 May 2015, 18:46

Yeah systemd is definatley the way to go but I'm fairly new to arch so I'm still finding my feet. I did install a shutdown/reboot service to reset some relays but I just copied the code and adjusted it to run my script instead I don't fully understand how it works.

You are correct about sudo, rune only has the root account enabled. Sudoing commands will throw an error.
bevlar
 
Posts: 26
Joined: 16 Mar 2015, 10:52

support RuneAudio Donate with PayPal

Next

Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 4 guests
cron