Read arduino's sensors with debian and save values to file without resetting.

So i have Arduino UNO with few sensors. I want to read sensors from serial and save them to file in debian/linux.
I have my way to get it working but the problem is that everytime i read it the arduino resets.

Can someone gimme a hand on making a better script to read it without resetting it.

Im now doing it with this:

#!/bin/sh


#double because the first line is double from 1-wire sensors
/usr/bin/head -n5 /dev/ttyUSB0 > /root/lammot.dat 
/usr/bin/head -n5 /dev/ttyUSB0 > /root/lammot.dat


if test -s /root/lammot.dat; then
  echo OK!
 cp /root/lammot.dat /root/arvot.dat
else
  echo tiedosto tyhjä
  exit
fi

# update graphs
/root/lue_ja_paivita_kuvat
/root/valo/lue_ja_paivita_kuvat
/root/kosteus/lue_ja_paivita_kuvat

It's likely that DTR is dropping.

The info page for stty indicates the with the 'hup' flag set for the tty, the driver will send a 'hangup' when the last process closes the tty. Well, if there's just one process, in your case the head command, it will be the last one too. I don't know that 'hup' is a default, but this it what I'd try 1st.

stty -F /dev/ttyUSB0 -hup

to turn off hangups.

If that doesn't help, then try

stty -F /dev/ttyUSB0 clocal

to disable modem control signals.

Also see http://arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection

Many examples of reading from the serial port here: Arduino Playground - InterfacingWithSoftware