#!/bin/bash

# Please define the IP address of ARecX6.
ARECX6=192.168.0.2

rec_status=`/usr/bin/wget -q -O - http://${ARECX6}/cgi/get.cgi?type=top | awk 'BEGIN{ FS="," }{ if ($1=="rec_status") print $2 }'`
if [ "$rec_status" -ne "1" ]; then
  /usr/bin/wget -q -O - http://${ARECX6}/cgi/get.cgi?type=reboot&rnd=1
  sleep 60
  /usr/bin/wget -q -O - http://${ARECX6}/cgi/get.cgi?type=rec_start&rnd=1
fi
