ReferencePlatforms/Test/Maemo: Difference between revisions

Jump to navigation Jump to search
Line 321: Line 321:
=== Set up a daily reboot ===
=== Set up a daily reboot ===


I've seen too many devices hang or lose buildbot connectivity, then go idle for days and shut themselves off.  To try to combat this, I'm trying to make sure none of them stay up for more than 1-2 days.
I've seen too many devices hang or lose buildbot connectivity, then go idle for days and shut themselves off.  To try to combat this, I'm trying to make sure none of them stay up for more than <s>1-2 days</s> they need to.


Create an <tt>/etc/cron.daily/daily_reboot.sh</tt> :
Create an <tt>/etc/cron.daily/daily_reboot.sh</tt> :
Line 327: Line 327:
  #!/bin/sh
  #!/bin/sh
   
   
  uptime | grep day > /dev/null
  REBOOT=0
UPTIME=`uptime | sed -e 's/^.*up *\([^,]*\).*$/\1/'`
echo $UPTIME | grep 'day' >/dev/null 2>&1
  if [ $? -eq 0 ] ; then
  if [ $? -eq 0 ] ; then
         echo "`hostname` has been up too long... rebooting!"
         echo "$0: `hostname` has been up over a day."
        REBOOT=1
fi
BUILDBOT_PROCS=`ps | grep buildbot | grep -v grep | wc -l`
if [ $BUILDBOT_PROCS -lt 1 ] ; then
        echo $UPTIME | grep ':' >/dev/null 2>&1
        if [ $? -eq 0 ] ; then
                echo "$0: `hostname` up for over an hour with no buildbot!"
                REBOOT=1
        else
                MIN_UPTIME=`echo $UPTIME | sed -e 's/ *min$//'`
                if [ $MIN_UPTIME -gt 30 ] ; then
                        echo "$0: `hostname` up for over 30 min with no buildbot!"
                        REBOOT=1
                fi
        fi
fi
if [ $REBOOT -gt 0 ] ; then
        echo "$0: rebooting!"
         reboot
         reboot
         sleep 600
         sleep 600
Confirmed users
4,971

edits

Navigation menu