ReferencePlatforms/Test/Maemo: Difference between revisions

Jump to navigation Jump to search
Line 328: Line 328:
   
   
  REBOOT=0
  REBOOT=0
  UPTIME=`uptime | sed -e 's/^.*up *\([^,]*\).*$/\1/'`
  UPTIME=`uptime | sed -e 's/^.*up *\([^,]*\).*$/\1/'`
BUILDBOT_PROCS=`ps | grep buildbot | grep -v grep | wc -l`
HOSTNAME=`hostname`
   
   
  echo $UPTIME | grep 'day' >/dev/null 2>&1
  echo $UPTIME | grep 'day' >/dev/null 2>&1
  if [ $? -eq 0 ] ; then
  if [ $? -eq 0 ] ; then
         echo "$0: `hostname` has been up over a day."
         echo "$0: $HOSTNAME has been up over a day."
         REBOOT=1
         REBOOT=1
  fi
  fi
   
   
BUILDBOT_PROCS=`ps | grep buildbot | grep -v grep | wc -l`
  if [ $BUILDBOT_PROCS -lt 1 ] ; then
  if [ $BUILDBOT_PROCS -lt 1 ] ; then
         echo $UPTIME | grep ':' >/dev/null 2>&1
         echo $UPTIME | grep ':' >/dev/null 2>&1
         if [ $? -eq 0 ] ; then
         if [ $? -eq 0 ] ; then
                 echo "$0: `hostname` up for over an hour with no buildbot!"
                 echo "$0: $HOSTNAME up for over an hour with no buildbot!"
                 REBOOT=1
                 REBOOT=1
         else
         else
                 MIN_UPTIME=`echo $UPTIME | sed -e 's/ *min$//'`
                 MIN_UPTIME=`echo $UPTIME | sed -e 's/ *min$//'`
                 if [ $MIN_UPTIME -gt 30 ] ; then
                 if [ $MIN_UPTIME -gt 30 ] ; then
                         echo "$0: `hostname` up for over 30 min with no buildbot!"
                         echo "$0: $HOSTNAME up for over 30 min with no buildbot!"
                         REBOOT=1
                         REBOOT=1
                 fi
                 fi
Line 353: Line 353:
   
   
  if [ $REBOOT -gt 0 ] ; then
  if [ $REBOOT -gt 0 ] ; then
         echo "$0: rebooting!"
         echo "$0: $HOSTNAME rebooting!"
         reboot
         reboot
         sleep 600
         sleep 600
  fi
  fi


Then
Then
Confirmed users
4,971

edits

Navigation menu