diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite index bda970d..0b4fe16 100644 Binary files a/.vs/slnx.sqlite and b/.vs/slnx.sqlite differ diff --git a/.vs/wz_mini_hacks/v16/.suo b/.vs/wz_mini_hacks/v16/.suo index 4264405..6977807 100644 Binary files a/.vs/wz_mini_hacks/v16/.suo and b/.vs/wz_mini_hacks/v16/.suo differ diff --git a/SD_ROOT/wz_mini/etc/crontab/root b/SD_ROOT/wz_mini/etc/crontab/root index 4c955c6..1d86f60 100644 --- a/SD_ROOT/wz_mini/etc/crontab/root +++ b/SD_ROOT/wz_mini/etc/crontab/root @@ -8,3 +8,5 @@ # | | | | | # * * * * * user-name command to be executed #45 05 * * * /sbin/reboot +#Use example below to update the hosts file with the correct ip to c1ybkrkbr1j10x.credentials.iot.us-west-2.amazonaws.com +#00 00 * * * /opt/wz_mini/etc/rc.local.d/setup_hosts.sh \ No newline at end of file diff --git a/SD_ROOT/wz_mini/etc/crontab/start_cron.sh b/SD_ROOT/wz_mini/etc/crontab/start_cron.sh deleted file mode 100644 index 2e0f28d..0000000 --- a/SD_ROOT/wz_mini/etc/crontab/start_cron.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -##Verify the network is up before continuing -until ping -c1 www.google.com >/dev/null 2>&1; do :; done - -/opt/wz_mini/tmp/.bin/crond -b -c /opt/wz_mini/etc/crontab/ - -touch /tmp/test_hosts -echo 127.0.0.1 localhost >>/tmp/test_hosts -dns=$(cat /etc/resolv.conf | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | head -1) -server=$(nslookup c1ybkrkbr1j10x.credentials.iot.us-west-2.amazonaws.com $dns | awk -F': ' 'NF==2 { print $2 } ' | head -1) -echo $server c1ybkrkbr1j10x.credentials.iot.us-west-2.amazonaws.com >>/tmp/test_hosts -mount --bind /tmp/test_hosts /etc/hosts diff --git a/SD_ROOT/wz_mini/etc/rc.local.d/setup_hosts.sh b/SD_ROOT/wz_mini/etc/rc.local.d/setup_hosts.sh new file mode 100644 index 0000000..8dfc663 --- /dev/null +++ b/SD_ROOT/wz_mini/etc/rc.local.d/setup_hosts.sh @@ -0,0 +1,20 @@ +#!/bin/sh +##Verify the network is up before continuing +until ping -c1 www.google.com >/dev/null 2>&1; do :; done +FILE=/tmp/test_hosts +if test -f "$FILE"; then +#We just need to clear and re generate. rebuilding the file is kinda pointless and script may be used on long running cameras. +true > /tmp/test_hosts +echo 127.0.0.1 localhost >>/tmp/test_hosts +dns=$(cat /etc/resolv.conf | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | head -1) +server=$(nslookup c1ybkrkbr1j10x.credentials.iot.us-west-2.amazonaws.com $dns | awk -F': ' 'NF==2 { print $2 } ' | head -1) +echo $server c1ybkrkbr1j10x.credentials.iot.us-west-2.amazonaws.com >>/tmp/test_hosts +else +#generate the file and mount +touch /tmp/test_hosts +echo 127.0.0.1 localhost >>/tmp/test_hosts +dns=$(cat /etc/resolv.conf | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | head -1) +server=$(nslookup c1ybkrkbr1j10x.credentials.iot.us-west-2.amazonaws.com $dns | awk -F': ' 'NF==2 { print $2 } ' | head -1) +echo $server c1ybkrkbr1j10x.credentials.iot.us-west-2.amazonaws.com >>/tmp/test_hosts +mount --bind /tmp/test_hosts /etc/hosts +fi diff --git a/SD_ROOT/wz_mini/etc/rc.local.d/start_cron.sh b/SD_ROOT/wz_mini/etc/rc.local.d/start_cron.sh new file mode 100644 index 0000000..2b30c26 --- /dev/null +++ b/SD_ROOT/wz_mini/etc/rc.local.d/start_cron.sh @@ -0,0 +1,4 @@ +#!/bin/sh +##Verify the network is up before continuing +until ping -c1 www.google.com >/dev/null 2>&1; do :; done + /opt/wz_mini/tmp/.bin/crond -b -c /opt/wz_mini/etc/crontab/