I am attempting to have a program load on boot and have successfully achieved my desired function by modifying the /etc/rc.local file and adding the following line -
(sleep 15; python /home/pi/Desktop/DatabaseController.py) &
This is the majority of the DatabaseController.py file, I believe the loop_start is a blocking function -
def main(): clientName = "DatabaseController" serverAddress = "10.116.10.191" mqttClient = mqtt.Client(clientName) mqttClient.on_connect = connectionStatus mqttClient.on_message = messageDecoder mqttClient.connect(serverAddress) mqttClient.loop_start() main() while True: print("Waiting...") time.sleep(.25)
My problem is that when I try to SSH into the Raspberry Pi to perform other functions it tells me Operation Timed Out. However, when I manually execute the line to run the code I am still able to SSH into the Raspberry Pi. How can I regain this ability? I've also tried using cron, but it did not work either.