With your help, I have written a program that reads from a serial port, does some stuff with the input and writes to mysql database in a endless loop. In short it looks something like this:
I am looking for a way of trapping the signal when someone/something trays to "kill -N myProgram.pid" so I wouldn't loose any data ($line), and close up database connections and sio device properly.
10x ahead.