Juli29

Untitled

Mar 8th, 2020
117
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pi@raspberrypi:~ $ sudo nano /usr/bin/cleanshutd
  2.  
  3. GNU nano 3.2 /usr/bin/cleanshutd
  4.  
  5.  
  6. daemon="on"
  7. while true; do
  8. while [ "$daemon" = "on" ]; do
  9. if shutdown_trigger; then
  10. /home/pi/RPi-Jukebox-RFID/scripts/./resume_play.sh -c=savepos && mpc clear
  11. /usr/bin/mpg123 /home/pi/RPi-Jukebox-RFID/shared/shutdownsound.mp3
  12. msg="BCM $trigger_pin held low, system shutdown in $shutdown_delay minutes"
  13. echo $msg
  14. wall $msg
  15. daemon="off"
  16. shutdown -h +$shutdown_delay
  17. break
  18. fi
  19. sleep $polling_rate
  20. done
  21.  
  22. while [ "$daemon" = "off" ]; do
  23. if [ ! -f /var/run/nologin ]; then
  24. raspi-gpio set $trigger_pin ip pu
  25. daemon="on"
  26. break
  27. fi
  28. if [ "$led_pin" != "off" ]; then
  29. raspi-gpio set $led_pin op dl
  30. sleep 0.1
  31. raspi-gpio set $led_pin op dh
  32. sleep $blink_time
  33. else
  34. sleep $polling_rate
  35. fi
  36. done
  37. done
  38.  
  39. exit 0
RAW Paste Data