Arduino serial read in script keeps hanging. Ideas?

I have a solar powered Arduino Fio out in a field playing weather station. All the data is get transmitted back over a XBee net. Last week I upgraded from XBee 2.4GHz's to XBee 900's. Now my serial_watcher.sh script crashes/hangs ever 4~6 hours.

serial_watcher.sh

#!/bin/bash

while read CHAR
do
  echo "${CHAR}" | logger
done < /dev/ttyUSB0

In a crashed state the script is still running, but no data is coming in.

# ps -ef | grep serial
root     13147     1  0 Aug28 ?        00:00:23 /bin/bash /root/bin/serial_watcher.sh

I am stumped on this one. Nothing in dmesg/messages. Yet is works fine for weeks on end with a 2.4GHz XBee.
If I restart my script every thing start working again, for a few hours.

# kill 13147
# nohup /root/bin/serial_watcher.sh &

XBee 2.4GHz

XBee 900

Any ideas?

What is the PC end XBee connected to? Does it have blinky lights? What are they showing? Are the blinky lights on the Fio? What do they tell you?

PC end XBee is attached to a XBee Explorer

As far as the lights? The XBee/Arduino sleep 99% of the time, and the lights are out (Both sides). When it does wake up, for about 3 seconds, both sides light up, and the RX/TX lights show a burst of activity.

If I switch back to my 2.4GHz XBee's everything works (No code changes). I am guessing I am getting some kind of control charter that is causing my while loop to crash. But I cant see what that control charter is do to the crash... Nasty catch 22.

If all that you are changing is hardware (which XBees are in use), then it really seems unlikely that the software on either end is the culprit.

If I understood you correctly, the LEDs on the USB Explorer continue to flash, indicating that the XBee has received data and sent it to the serial port pins, but your script has stopped reading the serial port. Is that correct?

I never found the root cause. I hacked some code together that can spot the problem.

reader.sh

#!/bin/bash
TMP_DATE="/dev/shm/tmp.date.txt"
date +%s > $TMP_DATE

while read CHAR
do
  echo "${CHAR}" | logger
  date +%s > $TMP_DATE
done < /dev/ttyUSB0

watcher.sh (Setup to run from cron once a minute)

#!/bin/bash
#Version=0.5

HOME_PATH="/root/bin"
SCRIPT="serial_watcher.sh"
FULL_PATH="${HOME_PATH}/${SCRIPT}"
TMP_DATE="/dev/shm/tmp.date.txt"

#Check:  Has it run in the last 7min (420 sec)
CURRENT_TMP_DATE=`date +%s`
LAST_WRITTEN_DATE=`cat $TMP_DATE`
DIFF=$(($CURRENT_TMP_DATE - $LAST_WRITTEN_DATE))

if [ $DIFF -gt 420 ];then
  logger "$0 ERROR: $SCRIPT has not responded in $DIFF seconds, restarting"
  killall $SCRIPT
  nohup $FULL_PATH &
fi