Forum
  • Search
  • Member List
  • Calendar
Hello There, Guest! Login Register — Login with Facebook

Startup Shutdown Button Pi
Thank you for your donation

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
Startup Shutdown Button Pi
12th May, 2017, 02:55 AM
Post: #1
TheDutypaid Offline
Registered
Posts: 27
Joined: Apr 2017
Reputation: 0
Startup Shutdown Button Pi
At the moment when I power on I plug in my Pi and when power off, I go through the shutdown menu.

I was reading this RetroPie Shutdown and Startup Switch – The Easy Way

The install is from a script

Code:
curl http://pie.8bitjunkie.net/shutdown/setup-shutdown.sh | bash

Would this work with Xbian?
Find all posts by this user
Quote this message in a reply
13th May, 2017, 12:10 AM
Post: #2
TheDutypaid Offline
Registered
Posts: 27
Joined: Apr 2017
Reputation: 0
RE: Startup Shutdown Button Pi
Just installed the script and nothing happens when the switch is pressed.

Is there another way I can add a startup and shutdown switch to the Pi for this?
Find all posts by this user
Quote this message in a reply
13th May, 2017, 01:28 AM (This post was last modified: 13th May, 2017 01:29 AM by Nachteule.)
Post: #3
Nachteule Offline
Administrator
******
Posts: 2,405
Joined: Dec 2014
Reputation: 122
RE: Startup Shutdown Button Pi
Sure, probably there are millions of solutions for doing this.

In your case, if you would read RetroPie installer script you will see that the python stuff is downloaded to home of user pi, but XBian does not have user pi.

So you have to download script, modify it (change all pi to xbian) and try again
Find all posts by this user
Quote this message in a reply
13th May, 2017, 07:23 AM
Post: #4
TheDutypaid Offline
Registered
Posts: 27
Joined: Apr 2017
Reputation: 0
RE: Startup Shutdown Button Pi
Hi Nachteule.

I changed the script in Notepad ++ (which I think may work) I'm not sure where the file needs to be placed I am using WinSCP

Code:
#!/bin/bash
# setup-shutdown.sh
# Installs python script to enable safe shutdown of Raspberry Pi on PIN5/GPIO3 Logic LOW
# Author:  8bitjunkie.net
# Adapted from https://svn.nwesd.org/linuxdev/config_samples/lenny_setup/setup-denyhosts

# INSTRUCTIONS:
# Download and run this setup script in the terminal using the following command:
#  curl http://pie.8bitjunkie.net/shutdown/setup-shutdown.sh | bash

################################################################################​###################################
# Copyright 2017 8bitjunkie.net
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#    http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################​###################################

set -u # fail on unset vars

echo; echo
echo -e "\e[96mThis script will install a python script to enable shutdown of Raspberry Pi upon PIN5/GPIO3 Logic LOW\e[0m"
echo; echo
echo -e "\e[96mVisit \e[4;96mhttp://pie.8bitjunkie.net\e[0;96m for more information\e[0m"
echo; echo
sleep 5

#update packages and install python.gpio
echo -e "\033[31mUpdating packages\e[0m"
sudo apt-get -y update

echo; echo
echo -e "\033[31mInstalling python.gpio\e[0m"
sudo apt-get install --yes python-rpi.gpio python3-rpi.gpio </dev/null

#download scripts etc
mkdir /home/xbian/scripts &> /dev/null
echo; echo
echo -e "\033[31mDownloading shutdown scripts\e[0m"
curl -# "http://pie.8bitjunkie.net/shutdown/shutdown.py" > /home/xbian/scripts/shutdown.py
curl -# "http://pie.8bitjunkie.net/shutdown/shutdown.rc" > /tmp/pi_shutdown
sudo mv /tmp/pi_shutdown  /etc/init.d/pi_shutdown; chmod +x /etc/init.d/pi_shutdown
#fixme need a check here to see if curl was successful or not, also add retry options

echo; echo
echo -e "\033[31mAdd pi_shutdown to rc.d\e[0m"
sudo update-rc.d pi_shutdown defaults

#start shutdown.py now to avoid requiring reboot
echo; echo
echo -e "\033[31mRunning shutdown listener\e[0m"
sudo python /home/xbian/scripts/shutdown.py &> /dev/null &

echo; echo
echo -e "\033[31mShutdown is now installed\e[0m"
echo; echo

exit 0
Find all posts by this user
Quote this message in a reply
13th May, 2017, 08:42 AM
Post: #5
Nachteule Offline
Administrator
******
Posts: 2,405
Joined: Dec 2014
Reputation: 122
RE: Startup Shutdown Button Pi
(13th May, 2017 07:23 AM)TheDutypaid Wrote:  Hi Nachteule.

I changed the script in Notepad ++ (which I think may work) I'm not sure where the file needs to be placed I am using WinSCP

Every place you want, good place is /tmp, because this folder will be cleaned when system boots
Please note before running scrirpt you have to make it executable (chmod +x) or run script via sh <script>

Please note after running script you have to change pi -> xbian in /etc/init.d/pi_shutdown also
AND
sudo apt-get install --yes python-rpi.gpio python3-rpi.gpio </dev/null
will fail because those two packages are NOT in raspbian repo, I suppose they are in retropie repo
Find all posts by this user
Quote this message in a reply
13th May, 2017, 08:55 AM
Post: #6
Nachteule Offline
Administrator
******
Posts: 2,405
Joined: Dec 2014
Reputation: 122
RE: Startup Shutdown Button Pi
... or you have to grab it from here and here
Find all posts by this user
Quote this message in a reply
22nd Apr, 2020, 05:53 AM
Post: #7
Gauner Offline
Registered
Posts: 20
Joined: Apr 2020
Reputation: 0
RE: Startup Shutdown Button Pi
You could also dig into the dtoverlay=gpio-shutdown.
At least the Raspberry Pi 3B+ is prepared to just wire a button on PIN 5 and 6 which starts the Pi from halted and send a KEY_POWER Event while running.
Which (as a matter of fact) Kodi just reacts to with a shutdown menu, not an immediate shutdown process, but that's another story. (Has somebody an idea hot to make XBian shutdown on that event, but make Kodi show the shutdown menu when I press the button on the remote control?)
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:

Current time: 12th May, 2025, 08:33 PM Powered By MyBB, © 2002-2025 MyBB Group.