So I'm trying to make this python script run on launch. It should remain mostly still, but when the motion sensor is triggered, I want the camera to start recording and the motor to move. Ultimately, this process needs to happen when I'm headless, so having it start automatically on bootup is the easiest way to do this. I've tried using this init.d file to make it run automatically, but I get the following error message:
Starting mylauncher
from: can't read /var/mail/gpiozero
from: can't read /var/mail/gpiozero
from: can't read /var/mail/picamera
/home/pi/Detector.py: 4: /home/pi/Detector.py: import: not found
from: can't read /var/mail/time
/home/pi/Detector.py: 7: /home/pi/Detector.py: Syntax error: "(" unexpected
I googled it, and people suggested putting in #!/usr/bin/python as the very first line, but when I do that, I get
File "/etc/init.d/mylauncher", line 18
case "$1" in
^
SyntaxError: invalid syntax
How can I get rid of both of these errors and make sure the script runs on startup?