I want to make one of my projects begin upon startup and found a few tutorials for that, but I want to make it so it only auto-activates when no monitor is detected. I have a pi4, and have heard it doesn't boot up if no monitor is plugged in.
I tried the method with rc.local(Method 1 in the linked site), which didn't work with the program i want to run(perhaps because the program requires bluetooth to an external device?). I did try this method with a simple led flashing code, and it totally worked. Even when i added an LED to the code to indicate when to connect the devices, the LED never lit up. I checked everything over again, but it all looked fine. If you know how to fix this, please let me know.
Script file path I'm trying to run is /home/pi/suit.py
Rather important note- I only have coding experience in Python using thonny, so anything short of step-by-step instructions and you've lost me before you started. Sorry for my inexperience.
Current code from /etc/rc.local (not including comments)
-IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My Ip address is %s\n" "$_IP"
fi
sudo python /home/pi/suit.py &
exit 0