#!/bin/sh

export PATH=/opt/lnxall_app/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin

check_uptime() {
	local tim0=$1
	local tim1="$(cat /proc/uptime | awk -F. '{print $1}')"

	if [ ${tim0} -le ${tim1} ] ; then
		return 1
	fi
	while [ ${tim0} -gt ${tim1} ] ; do
		echo "Sleeping: $((tim0 - tim1))"
		sleep $((tim0 - tim1))
		tim1="$(cat /proc/uptime | awk -F. '{print $1}')"
	done
	return 0
}

if check_uptime 35 ; then
	nmcli con up lan ; sleep 5
fi
exec busybox "$@"
