Shutdown Script for Retropie

Total Page:16

File Type:pdf, Size:1020Kb

Shutdown Script for Retropie Shutdown Script for Retropie Use pin number 5 & 14 for “Shutdown” 1. Update RetroPie: • sudo apt-get update 2. Upgrade RetroPie • sudo apt-get upgrade 3. Install Python • sudo apt-get install python-dev • sudo apt-get install python3-dev • sudo apt-get install gcc • sudo apt-get install python-pip 4. Next you need to get RPi.GPIO: • wget https://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.5.11.tar.gz 5. Extract the packages: • sudo tar -zxvf RPi.GPIO-0.5.11.tar.gz 6. Move into the newly created directory: • cd RPi.GPIO-0.5.11 • 7. Install the module by doing: • sudo python setup.py install • sudo python3 setup.py install 8. Creating a directory to hold your scripts: • mkdir /home/pi/scripts 9. Call our script shutdown.py (it is written in python). Create and edit the script by doing: • sudo nano /home/pi/scripts/shutdown.py The content of the script: Paste it in the blank area #!/usr/bin/python import RPi.GPIO as GPIO import time import subprocess # we will use the pin numbering to match the pins on the Pi, instead of the # GPIO pin outs (makes it easier to keep track of things) GPIO.setmode(GPIO.BOARD) # use the same pin that is used for the reset button (one button to rule them all!) GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_UP) oldButtonState1 = True while True: #grab the current button state buttonState1 = GPIO.input(5) # check to see if button has been pushed if buttonState1 != oldButtonState1 and buttonState1 == False: subprocess.call("shutdown -h now", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) oldButtonState1 = buttonState1 time.sleep(.1) Press CRTL X Then Y and Enter 10. Restart the pi • sudo reboot 11. Configure our script to run at startup, • sudo nano /etc/rc.local Add the following to the file • sudo python /home/pi/scripts/shutdown.py & Press CRTL X Then Y and Enter .
Recommended publications
  • Adding a Shutdown Button to the Raspberry Pi B+  Version 1
    Welcome, Guest Log in Register Activity Translate Content Search within content, members or groups Search Topics Resources Members Design Center Store All Places > Raspberry Pi > Raspberry Pi Projects > Documents Adding a Shutdown Button to the Raspberry Pi B+ Version 1 Created by ipv1 on Aug 4, 2015 3:05 AM. Last modified by ipv1 on Aug 18, 2015 9:52 AM. Introduction What do you need? Step 1. Setup the RPi Step 2. Connecting the button Step 3. Writing a Python Script Step 4. Adding it to startup Step 5. More to do Introduction For a beginner to the world of raspberry pi, there are a number of projects that can become the start of something big. In this article, I discuss such a simple project which is adding a button that can be used to shutdown the raspberry pi using a bit of software tinkering. I wrote a similar article in 2013 at my blog “embeddedcode.wordpress.com” and its got its share of attention since a lot of people starting out with a single board computer, kept looking for a power button. Additionally, those who wanted a headless system, needed a way to shutdown the computer without the mess of connecting to it over the network or attaching a monitor and keyboard to it. In this article, I revisit the tutorial on how to add a shutdown button while trying to explain the workings and perhaps beginners will find it an amusing to add find more things to do with this little recipe. What do you need? Here is a basic bill of materials required for this exercise.
    [Show full text]
  • Shutdown Policies with Power Capping for Large Scale Computing Systems Anne Benoit, Laurent Lefèvre, Anne-Cécile Orgerie, Issam Raïs
    Shutdown Policies with Power Capping for Large Scale Computing Systems Anne Benoit, Laurent Lefèvre, Anne-Cécile Orgerie, Issam Raïs To cite this version: Anne Benoit, Laurent Lefèvre, Anne-Cécile Orgerie, Issam Raïs. Shutdown Policies with Power Capping for Large Scale Computing Systems. Euro-Par: International European Conference on Parallel and Distributed Computing, Aug 2017, Santiago de Compostela, Spain. pp.134 - 146, 10.1109/COMST.2016.2545109. hal-01589555 HAL Id: hal-01589555 https://hal.archives-ouvertes.fr/hal-01589555 Submitted on 18 Sep 2017 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Shutdown policies with power capping for large scale computing systems Anne Benoit1, Laurent Lef`evre1, Anne-C´ecileOrgerie2, and Issam Ra¨ıs1 1 Univ. Lyon, Inria, CNRS, ENS de Lyon, Univ. Claude-Bernard Lyon 1, LIP 2 CNRS, IRISA, Rennes, France Abstract Large scale distributed systems are expected to consume huge amounts of energy. To solve this issue, shutdown policies constitute an appealing approach able to dynamically adapt the resource set to the actual workload. However, multiple constraints have to be taken into account for such policies to be applied on real infrastructures, in partic- ular the time and energy cost of shutting down and waking up nodes, and power capping to avoid disruption of the system.
    [Show full text]
  • LAB MANUAL for Computer Network
    LAB MANUAL for Computer Network CSE-310 F Computer Network Lab L T P - - 3 Class Work : 25 Marks Exam : 25 MARKS Total : 50 Marks This course provides students with hands on training regarding the design, troubleshooting, modeling and evaluation of computer networks. In this course, students are going to experiment in a real test-bed networking environment, and learn about network design and troubleshooting topics and tools such as: network addressing, Address Resolution Protocol (ARP), basic troubleshooting tools (e.g. ping, ICMP), IP routing (e,g, RIP), route discovery (e.g. traceroute), TCP and UDP, IP fragmentation and many others. Student will also be introduced to the network modeling and simulation, and they will have the opportunity to build some simple networking models using the tool and perform simulations that will help them evaluate their design approaches and expected network performance. S.No Experiment 1 Study of different types of Network cables and Practically implement the cross-wired cable and straight through cable using clamping tool. 2 Study of Network Devices in Detail. 3 Study of network IP. 4 Connect the computers in Local Area Network. 5 Study of basic network command and Network configuration commands. 6 Configure a Network topology using packet tracer software. 7 Configure a Network topology using packet tracer software. 8 Configure a Network using Distance Vector Routing protocol. 9 Configure Network using Link State Vector Routing protocol. Hardware and Software Requirement Hardware Requirement RJ-45 connector, Climping Tool, Twisted pair Cable Software Requirement Command Prompt And Packet Tracer. EXPERIMENT-1 Aim: Study of different types of Network cables and Practically implement the cross-wired cable and straight through cable using clamping tool.
    [Show full text]
  • Maintenance Commands for Avaya Communication Manager, Media Gateways and Servers
    Maintenance Commands for Avaya Communication Manager, Media Gateways and Servers 03-300431 Issue 4 January 2008 © 2008 Avaya Inc. All Rights Reserved. Notice While reasonable efforts were made to ensure that the information in this document was complete and accurate at the time of printing, Avaya Inc. can assume no liability for any errors. Changes and corrections to the information in this document may be incorporated in future releases. For full legal page information, please see the complete document, Avaya Legal Page for Software Documentation, Document number 03-600758. To locate this document on the website, simply go to http://www.avaya.com/support and search for the document number in the search box. Documentation disclaimer Avaya Inc. is not responsible for any modifications, additions, or deletions to the original published version of this documentation unless such modifications, additions, or deletions were performed by Avaya. Customer and/or End User agree to indemnify and hold harmless Avaya, Avaya's agents, servants and employees against all claims, lawsuits, demands and judgments arising out of, or in connection with, subsequent modifications, additions or deletions to this documentation to the extent made by the Customer or End User. Link disclaimer Avaya Inc. is not responsible for the contents or reliability of any linked Web sites referenced elsewhere within this documentation, and Avaya does not necessarily endorse the products, services, or information described or offered within them. We cannot guarantee that these links will work all of the time and we have no control over the availability of the linked pages. Warranty Avaya Inc.
    [Show full text]
  • Command Reference Guide for Cisco Prime Infrastructure 3.9
    Command Reference Guide for Cisco Prime Infrastructure 3.9 First Published: 2020-12-17 Americas Headquarters Cisco Systems, Inc. 170 West Tasman Drive San Jose, CA 95134-1706 USA http://www.cisco.com Tel: 408 526-4000 800 553-NETS (6387) Fax: 408 527-0883 THE SPECIFICATIONS AND INFORMATION REGARDING THE PRODUCTS IN THIS MANUAL ARE SUBJECT TO CHANGE WITHOUT NOTICE. ALL STATEMENTS, INFORMATION, AND RECOMMENDATIONS IN THIS MANUAL ARE BELIEVED TO BE ACCURATE BUT ARE PRESENTED WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. USERS MUST TAKE FULL RESPONSIBILITY FOR THEIR APPLICATION OF ANY PRODUCTS. THE SOFTWARE LICENSE AND LIMITED WARRANTY FOR THE ACCOMPANYING PRODUCT ARE SET FORTH IN THE INFORMATION PACKET THAT SHIPPED WITH THE PRODUCT AND ARE INCORPORATED HEREIN BY THIS REFERENCE. IF YOU ARE UNABLE TO LOCATE THE SOFTWARE LICENSE OR LIMITED WARRANTY, CONTACT YOUR CISCO REPRESENTATIVE FOR A COPY. The Cisco implementation of TCP header compression is an adaptation of a program developed by the University of California, Berkeley (UCB) as part of UCB's public domain version of the UNIX operating system. All rights reserved. Copyright © 1981, Regents of the University of California. NOTWITHSTANDING ANY OTHER WARRANTY HEREIN, ALL DOCUMENT FILES AND SOFTWARE OF THESE SUPPLIERS ARE PROVIDED “AS IS" WITH ALL FAULTS. CISCO AND THE ABOVE-NAMED SUPPLIERS DISCLAIM ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THOSE OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OR ARISING FROM A COURSE OF DEALING, USAGE, OR TRADE PRACTICE. IN NO EVENT SHALL CISCO OR ITS SUPPLIERS BE LIABLE FOR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, OR INCIDENTAL DAMAGES, INCLUDING, WITHOUT LIMITATION, LOST PROFITS OR LOSS OR DAMAGE TO DATA ARISING OUT OF THE USE OR INABILITY TO USE THIS MANUAL, EVEN IF CISCO OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
    [Show full text]
  • Pi-Uptimeups How to Use Python
    How to use the Python demo program For Pi-UpTimeUPS and Pi-Zero-UpTime (PiZ-UpTime) boards (The >> line shows the commands to execute). You need to open a command line window to execute these scripts. Step 1 Make sure you have the latest version of the operating system. >> sudo apt-get update >> sudo apt-get dist-upgrade (Skip this step if you DO NOT want to upgrade to Raspbian STRETCH. Doing this will automatically upgrade you to STRETCH. Say Yes to installing updates/upgrades.) >> sudo apt-get upgrade >> sudo apt-get autoclean If the dist-upgrade went through with updates, please reboot the Pi to ensure you have the latest OS and updates. Step 2 In the home directory (or some other location), create a separate folder. >> mkdir some-folder-name (for example, mkdir uptime) >> cd some-folder-name (for example, cd uptime) Use wget and download the python script from the alchemy-power web site. >> wget http://alchemy-power.com/wp-content/uploads/2017/06/GPIO-shutdown-sample.zip This creates a file GPIO-shutdown-sample.zip file. Step 3 Unzip the GPIO-shutdown-sample.zip file using the unzip command >> unzip GPIO-shutdown-sample.zip This creates a GPIO-shutdown-sample.py file. Step 4 Run the program locally from the command line, from the directory where the file GPIO-shutdown- sample.py is located. >> sudo python GPIO-shutdown-sample.py How to use Python Code P a g e | 1 © 2017 Alchemy Power Inc., All Rights reserved. sudo privileges are needed so that when the battery runs low, the software can execute a proper shutdown.
    [Show full text]
  • Freebsd Command Reference
    FreeBSD command reference Command structure Each line you type at the Unix shell consists of a command optionally followed by some arguments , e.g. ls -l /etc/passwd | | | cmd arg1 arg2 Almost all commands are just programs in the filesystem, e.g. "ls" is actually /bin/ls. A few are built- in to the shell. All commands and filenames are case-sensitive. Unless told otherwise, the command will run in the "foreground" - that is, you won't be returned to the shell prompt until it has finished. You can press Ctrl + C to terminate it. Colour code command [args...] Command which shows information command [args...] Command which modifies your current session or system settings, but changes will be lost when you exit your shell or reboot command [args...] Command which permanently affects the state of your system Getting out of trouble ^C (Ctrl-C) Terminate the current command ^U (Ctrl-U) Clear to start of line reset Reset terminal settings. If in xterm, try Ctrl+Middle mouse button stty sane and select "Do Full Reset" exit Exit from the shell logout ESC :q! ENTER Quit from vi without saving Finding documentation man cmd Show manual page for command "cmd". If a page with the same man 5 cmd name exists in multiple sections, you can give the section number, man -a cmd or -a to show pages from all sections. man -k str Search for string"str" in the manual index man hier Description of directory structure cd /usr/share/doc; ls Browse system documentation and examples. Note especially cd /usr/share/examples; ls /usr/share/doc/en/books/handbook/index.html cd /usr/local/share/doc; ls Browse package documentation and examples cd /usr/local/share/examples On the web: www.freebsd.org Includes handbook, searchable mailing list archives System status Alt-F1 ..
    [Show full text]
  • Forcepoint Appliances Command Line Interface (CLI) Guide
    Forcepoint Appliances Command Line Interface (CLI) Guide V Series, X Series, & Virtual Appliances v8.4.x ©2018, Forcepoint All rights reserved. 10900-A Stonelake Blvd, Quarry Oaks 1, Suite 350, Austin TX 78759 Published 2018 Forcepoint and the FORCEPOINT logo are trademarks of Forcepoint. Raytheon is a registered trademark of Raytheon Company. All other trademarks used in this document are the property of their respective owners. This document may not, in whole or in part, be copied, photocopied, reproduced, translated, or reduced to any electronic medium or machine- readable form without prior consent in writing from Forcepoint. Every effort has been made to ensure the accuracy of this manual. However, Forcepoint makes no warranties with respect to this documentation and disclaims any implied warranties of merchantability and fitness for a particular purpose. Forcepoint shall not be liable for any error or for incidental or consequential damages in connection with the furnishing, performance, or use of this manual or the examples herein. The information in this documentation is subject to change without notice. Contents Topic 1 Forcepoint Appliances Command Line Interface . .1 Conventions . .1 Logon and authentication . .2 CLI modes and account privileges . .2 Basic account management . .3 Command syntax. .9 Help for CLI commands . .9 System configuration . .10 Time and date . .11 Host name and description . .14 User certificates. .15 Filestore definition and file save commands. .16 Appliance interface configuration. .18 Appliance vswitch configuration . .29 Content Gateway Decryption Port Mirroring (DPM) . .29 Static routes. .31 Appliance status . .35 SNMP monitoring (polling) . .35 SNMP traps and queries . .38 Module-specific commands .
    [Show full text]
  • CLI Reference GS-2300 Series CLI Reference Contents
    connecting your business CLI Reference GS-2300 series CLI Reference Contents Contents 1 Operation of CLI Management.........................................................................................14 2 AAA Commands................................................................................................................19 2.1 acc­radius................................................................................................................................................19 2.2 accounting...............................................................................................................................................20 2.3 authorization...........................................................................................................................................21 2.4 deadtime.................................................................................................................................................21 2.5 fallback­author........................................................................................................................................22 2.6 radius......................................................................................................................................................22 2.7 show........................................................................................................................................................23 2.8 tacacs+....................................................................................................................................................25
    [Show full text]
  • Intel® Command Line Interface Features and Benefits
    Intel® Command Line Interface User Guide IntelIntel®®®® CoCoCommandCo mmand Line Interface Version 3.03.03.0 Legal Information INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL® PRODUCTS FOR THE PURPOSE OF SUPPORTING INTEL DEVELOPED SERVER BOARDS AND SYSTEMS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER, AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. UNLESS OTHERWISE AGREED IN WRITING BY INTEL, THE INTEL PRODUCTS ARE NOT DESIGNED NOR INTENDED FOR ANY APPLICATION IN WHICH THE FAILURE OF THE INTEL PRODUCT COULD CREATE A SITUATION WHERE PERSONAL INJURY OR DEATH MAY OCCUR. Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined." Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with this information. The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request. Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order.
    [Show full text]
  • Traceroute Mac Traceroute Mac
    2] Chapter 2 Catalyst 3560 Switch Cisco IOS Commands traceroute mac traceroute mac Use the traceroute mac privileged EXEC command to display the Layer 2 path taken by the packets from the specified source MAC address to the specified destination MAC address. traceroute mac [interface interface-id] {source-mac-address} [interface interface-id] {destination-mac-address} [vlan vlan-id] [detail] Syntax Description interface interface-id (Optional) Specify an interface on the source or destination switch. source-mac-address Specify the MAC address of the source switch in hexadecimal format. destination-mac-address Specify the MAC address of the destination switch in hexadecimal format. vlan vlan-id (Optional) Specify the VLAN on which to trace the Layer 2 path that the packets take from the source switch to the destination switch. Valid VLAN IDs are from 1 to 4094. detail (Optional) Specify that detailed information appears. Defaults There is no default. Command Modes Privileged EXEC Command History Release Modification 12.1(19)EA1 This command was first introduced. Usage Guidelines For Layer 2 traceroute to function properly, Cisco Discovery Protocol (CDP) must be enabled on all the switches in the network. Do not disable CDP. When the switch detects a device in the Layer 2 path that does not support Layer 2 traceroute, the switch continues to send Layer 2 trace queries and lets them time out. The maximum number of hops identified in the path is ten. Layer 2 traceroute supports only unicast traffic. If you specify a multicast source or destination MAC address, the physical path is not identified, and an error message appears.
    [Show full text]
  • Shell Commands
    Operating Systems Lab Islamic University – Gaza Engineering Faculty Department of Computer Engineering Fall 2012 ECOM 4010: Operating Systems Lab Eng: Ahmed M. Ayash Lab # 5 Shell Commands October 6, 2012 Linux Shell (Terminal): Shell Definition: is a special Linux component that acts as interface between user and kernel. Shell accepts user commands in English and passes them to the kernel to execute. Shell is a command language interpreter that executes commands read from keyboard or from a file. Shell is not part of the kernel; it uses it to execute programs. Shell Types: 1- BASH (Bourne-Again SHell): it is a freeware shell and most common shell in Linux. 2- CSH (C Shell): The C shell's syntax and usage are very similar to the C programming language. 3- KSH. 4- TCSH. 5- ZSH 6- BSH Tip: To find all available shells in your system type following command: $ cat /etc/shells By default, the BASH shell has a dollar sign ($) prompt, but Linux has several other types of shells, each with its own prompt. A shell prompt, such as the one shown here, marks the beginning of the command line: $ Structuring Commands - Commands have the following syntax: command options arguments 1 Some Shell Commands Command Syntax Function man $ man {command name} Get help about commands. info $ info {command name} Get help about commands. --help $ {command name} --help Get help about commands. whatis $ whatis {command name} Get help about commands. cat $ cat {file name} Display text file. date $ date Display current date and time $ date --date= '2012-10-10' Set the date to 2010-10-10(y,m,d).
    [Show full text]