one script starts automatically when my raspberry is booted up, within this script there is motion sensor, if detected, it starts a subproces camera.py (recording a video, then converts the video and emails)
within the main script that starts u on booting up, there is another if statement, if button pressed then stop the camera.py and everything in it and do something else.
I am unable to kill process by PID because it keeps changing. The only other option is to kill camera.py by its name, but it doesn't work.
main script:
p1 = subprocess.Popen("sudo python /home/pi/camera.py", shell=True)
this is my camera.py script:
import os
os.system("raspivid -n -o /home/pi/viseo.h264 -t 10000")
os.system(.... python script0.py
os.system(.... python script1.py
i can do:
os.system("sudo killall raspivid")
if i try
os.system("sudo killall camera.py")
it gives me a message: No process found
this only stops the recording but i also want to kill every other script within camera.py
Can anyone help please? thanks