Uncategorized

Headless Shutdown Button notes

Asked 
Viewed 21 times
1

I am new to Raspberry Pi and am trying to use the headless shutdown module provided by Adafruit.

I downloaded the script of Adafruit-GPIO-Halt to my Raspberry Pi, installed it to the /usr/local/bin/gpio-halt file and even made a file on the system/system folder, following the steps on https://www.recantha.co.uk/blog/?p=13999.

However, the file in the systemd/system folder is getting saved with a .service.save extension and system prevents me from using the line sudo chmod 644 /lib/systemd/system/gpio-halt.service by saying, ‘Permission denied.’

I would like to set-up the code to run on start-up. I am using Raspbian Version 9(stretch). Please help.

 New contributor
  • 1
    If you want help post a link to the module, and describe in detail what YOU did, not a link to an old tutorial for an obsolete OS. – Milliways yesterday
  • Hi @Atharv Goel, Welcome and nice to me you. Ah let me see, the headless Rpi shut down trick has many variations, yours is not that newbie friendly because you need to install the newbie scary Git thing, and compile a hard to understand C program. I would suggest you to try a more newbie friendly, no Git, no compile, just a short python script. / ton continue, … – tlfong01 yesterday   
  • 1
    Are you just trying to shutdown with a button? I thought you were referring to a power module NOT code. – Milliways yesterday
  • The secret Rpi shut down trick needs to short/connect two Rpi GPIO pins, using a manual switch, or just a paper clip. There is also a David Copperfield like magic variation using a tilt switch, then you don’t even need a paper clip, just TURN KEYBOARD UPSIDE DOWN and Rpi will switch off by itself. The trick is here: (1) Simple Shutdown Raspberry Pi Button by Using GPIO: instructables.com/id/… instructables.com/id/…. – tlfong01 yesterday   
  • The tilt switch, a cheapie toy like thing is just a switch which shorts/connects two contact points when you tilt it. For more details, you can search this forum using the keyword “tilt switch”. Now if you show your magic Rpi shut down to your bad friends or your daughter, then they would start to respect you more than you deserve. 🙂 – tlfong01 yesterday   
  • PS – I learnt this trick in Rpi One days, and I read about it from time to time in various forums. I guess this trick works in all OS versions of Rpi1/2/34. The other good thing is that although you don’t need to know how the program woks, if you like to know a little more about python “low level system” programming, eg, (1) How to mess around with the program starting rc.local file, (2) python OS commands like “os.system(‘sudo shutdown -h now’)”, you can show off this “advanced” stuff to your bad friends, convincing them you are not just a friendly, blindly, copy, paste, run programs guy. – tlfong01 yesterday   
  • 1
    Hello, for newer versions of Raspbian (like Stretch) the script/post you’re linking to is no longer required as the same functionality is provided by the gpio-shutdown device tree overlay: raspberrypi.stackexchange.com/a/77918/93934 – Roger Jones yesterday
  • @Roger Jones, Many thanks pointing out my ignorance about headless shut down. I googled and skimmed the following posts and found them very good: Raspberry pi powerdown and powerup button stderr.nl/Blog/Hardware/RaspberryPi/PowerButton.html. The ninja guys talking there make me embarrassingly losing face. – tlfong01 9 mins ago   
  • ERRATA AND APOLOGY – My earlier suggestion above using rc.local, python os command, GPIO monitoring daemon is TOTALLY RUBBISH. As advised by @Roger Jones, “gpio-shutdown” Device Tree overlay is the correct, trendy way to go: Reference: (1) “Raspberry Pi Power Down and Power Up Button”: stderr.nl/Blog/Hardware/RaspberryPi/PowerButton.html. Sorry again and cheers. (PS to the OP: If you misleadingly follow me, the old dog’s outdated rubbish suggestion, your bad friends should LOL and begin to respect you even less than you deserve) 🙂 – tlfong01 just now   Edit
  • ERRATA AND APOLOGY – My suggestion above using rc.local, python os command daemon is TOTALLY RUBBISH. As advised by @Roger Jones, gpio-shutdown is the correct way to go: Reference: (1) “Raspberry Pi Power Down and Power Up Button”: stderr.nl/Blog/Hardware/RaspberryPi/PowerButton.html. Sorry again and cheers. (PS to the OP: If you misleadingly follow me, the old dog’s outdated rubbish suggestion, your bad friends should begin to respect you even less than you deserve) 🙂 – tlfong01 54 secs ago    Edit   

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: