I cannot seem to get any of the options out there to work. I am trying to auto start a py file when the Raspberry Pi boots up. I need it to stay open and running continuously as it detects knock sensors. I can run the file perfectly when the RPi boots up and I type:
sudo python -i /var/www/html/liveSensor.py
into the terminal. I tried adding:
@reboot sudo python -i /var/www/html/liveSensor.py
to cron but it still doesn't work. I have seen people have success adding the file to the
pi/.config/ directory, but that directory does not exist on my RPi. I have an RPi 3 B running Raspbian.
What is the best way to accomplish this?