Raspi 3 Power Switch

  • I followed the instructions from howto-manually-add-gpio-openelec-raspberry-pi-2-without-addon on a button to shut down and restart my Pi. It only works if I am in Putty and actually start the script first but wont work after that. I've added the RaspiTools Addon bundle and tried it that way and it didin't work that way either so was wondering if anyone got this working on libreelec and could tell me what I am doing wrong? Here is how I wrote the code. I then put it in autostart.sh. Any help would be appreciated.


    [/code]


  • Autostart.sh is for shell scripts, I doubt you can use python code in there.

    You put the python code in shutdown.py and put that in scripts folder.
    You don't put the actual code in autostart.sh you put

    Code
    python /storage/scripts/shutdown.py &

    Edited once, last by Des804 (January 11, 2017 at 8:04 PM).