Moin, ich habe ein Pythonscript, welches ich über rc.local beim start aufrufe.
Es startet auch, macht aber nichts, ausser im Hintergrund zu laufen.
Rufe ich es manuell auf, macht es was es soll, ein shellscript ausführen, wenn ein Schalter betätigt wird.
Wenn ich es als root oder pi manell starte, klappt alles.
Berechtigung ist gesetzt, ausführbar ist es auch.
Besitzer ist pi, aber auch als Besitzer root keine Besserung.
rc.local
Ich habe es auch schon so im Script probiert, gleiches Problem:
#!/usr/bin/env python3
script.py
Python
#!/usr/bin/python3
# coding: utf-8
from __future__ import print_function
import RPi.GPIO as GPIO
import time, signal, os
from subprocess import call
GPIO.setmode(GPIO.BCM)
GPIO.setup(21, GPIO.IN)
def interrupt_event(pin):
zeit = time.strftime("%d.%m.%Y %H:%M:%S")
if GPIO.input(21) == GPIO.HIGH:
print('{} Schalter an Pin {} meldet offene Türe' .format(zeit, pin))
call('/home/pi/video0_email.sh')
else:
print('{} Schalter an Pin {} meldet geschlossene Türe' .format(zeit, pin))
try:
GPIO.add_event_detect(21, GPIO.BOTH, callback=interrupt_event, bouncetime=1)
#keep script running
signal.pause()
except KeyboardInterrupt:
print('Quit')
GPIO.cleanup()
Alles anzeigen
Irgendwie stehe ich wieder mal auf dem Schlauch.
Wie finde ich jetzt raus, warum es nur manuell läuft ?
MfG