Skip to content

Commit

Permalink
oref0-radio-reboot
Browse files Browse the repository at this point in the history
  • Loading branch information
scottleibrand committed Feb 18, 2017
1 parent bc9e7ab commit 74cc011
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bin/oref0-radio-reboot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
radio_errors=`tail /var/log/openaps/pump-loop.log | grep "spidev5.1 already in use"`
if [ ! -z "$radio_errors" ]
then
logfile=~/reset-log.txt
date >> $logfile
echo "Radio error found" | tee -a $logfile
wall "Rebooting to fix radio errors!"
reboot | tee -a $logfile
fi

5 comments on commit 74cc011

@PieterGit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @scottleibrand

I think this mechanism can also be used for the TI USB that sometimes disappears, see #354

I also have a whatdog script that checks pump-session age, which I scheduled 3 times an hour:

A=`find /home/pi/openapsdir/pump-session.json -mmin -20 | wc -l `
if [ "$A" -eq "0" ]; then
        /usr/local/bin/oref0-reset-usb &
        sudo shutdown -r +8
fi

C=`find /home/pi/openapsdir/cgm/glucose.json -mmin -20 | wc -l `
if [ "$C" -eq "0" ]; then
        /usr/local/bin/oref0-reset-usb &
        sudo shutdown -r +8
fi

@PieterGit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I extend the radio-reboot branch, or do you first bring it to dev branch?

@scottleibrand
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't that script cause a rig to reboot all day if you leave it at home and walk away with the pump? Seems we should instead detect and reboot only for things that represent unambiguous problems with the rig, not just the pump being out of range.

@PieterGit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i only use this on a mobile rig that i power up if it will be used.
sometimes my pump-log fails because it contains binary characters (miscommunication between CC1111 TI USB and pump). I'll try to find the good counterpart of grep "spidev5.1 already in use" for the failing TI USB part. Should I extend radio-reboot branch for that?

@scottleibrand
Copy link
Contributor Author

@scottleibrand scottleibrand commented on 74cc011 Feb 20, 2017 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.