Raspberry pi Shutdown using interrupt method (unwanted code appears on startup)
I am using the shortcut to turn off the raspberry pi using the interrupt method, and the code for it is:
#Import the modules to send commands to the system and access GPIO pins
from subprocess import call
import RPi.GPIO as gpio
# Define a function to keep script running
def loop():
raw_input()
# Define a function to run when an interrupt is called
def shutdown(pin):
call('halt', shell=False)
gpio.setmode(gpio.BOARD) # Set pin numbering to board numbering
gpio.setup(7, gpio.IN) # Set up pin 7 as an input
gpio.add_event_detect(7, gpio.RISING, callback=shutdown, bouncetime=200)
#Set up an interrupt to look for button presses
loop() # Run the loop function to keep script running
Then I set this script to run automatically on boot by adding this line python / home / pi / PiSupply / softshut.py to /etc/rc.local.
Shutdown occurs, but when you turn off this error appears on the screen.
map : vt01=>fb0
oops : terminated
After doing a little search, it turned out that it might be due to fbi. But since this doesn't cause any problems when shutting down, I just wanted this unwanted file to be redirected to the log file and not appear on the screen.
For this I tried:
os.system('pkill fbi')
os.system('pkill fbi >/dev/null 2>/dev/null')
exec 2> /tmp/rc.local.log
exec 1>&2
But nothing worked. Can someone please explain what is going on and how to stop spam from appearing on the screen, or perhaps remove the alltogether error.
+3
source to share