I've hit a dead end in my knowledge (and in my stubbornness)
I've written a logging script in python (reads settings from a txt file, then reads data from sensors and write them, along with a timestamp, in a logfile, put in an FTP server, hosted by the RPI.
Now that it's beginning to be ready to run properly I want to run it as a background process, to be able to do other things in the raspberry.
Thats fine, but I can't find a good way to exit the process if I somehow need to do some service to the device, or make changes to the script without cutting the power to the rpi.
I've managed to detective my way to it's pid and "kill" it, but that was (at least the way I did it) quite tricky, and not something I want to do every time. Besides, I'm afraid it will mess with the files or communication if it stops in the middle of the program. (open files, half finished communication problems, etc.)
I would like to be able to send some sort of signal so the script knows that the next time it circles back to the top of the while loop it will exit.
The only way i can think of it is to manipulate a file that it reads in the while-expression (don't even know if it can open file, read file, close file inside an expression...)
I would like a cleaner solution, and I would say I'm not the first who wants to communicate with a background process..
Thankful for all the help I can get