Currently I am reading data from a GPS receiver through USB on a raspberry pi and I would want to log this data on the SD card. I am collecting the data through Python by using
file = open("file.txt", "w") while True: ###PULL DATA THROUGH USB### file.write( DATA )
Currently I am SSHing ( using Putty) into the RPi to initiate this program. However there is no constant network connection to the RPi and thus SSH connection loses communication at times and sometimes the data doesn't isn't written and saved. I have also tried running the program at start-up by changing the rc.local but when I pull the power and extract the SD Card, the data seems to be lost.
Is the program still running if the SSH disconnects (goes out of receiver range)?
I was wondering what the best way to log data when there is no way to send a stop command (like a keyboard interrupt to end python data collection program) is?