#!/bin/sh

wget -P /tmp http://repo.dragino.com/release/patch/celluar_fixed/iot_keep_alive.sh

wget -P /tmp http://repo.dragino.com/release/patch/celluar_fixed/system-general.has


if [ -f /tmp/iot_keep_alive.sh ]; then
	mv /tmp/iot_keep_alive.sh /usr/bin/iot_keep_alive.sh
	chmod +x /usr/bin/iot_keep_alive.sh
	echo "iotkeepalive update done"

	kill $(ps |grep iot_keep_alive|grep -v grep|awk '{print $1}')
	/usr/bin/iot_keep_alive.sh &>/dev/null  &
else
	echo "iotkeepalive download fail"
fi

if [ -f /tmp/system-general.has ]; then
	mv /tmp/system-general.has /www/cgi-bin/system-general.has
	chmod +x /www/cgi-bin/system-general.has
	echo "has file update done"
else
	echo "has file download fail"
fi
