From b3035a869d9fb5c19072d1a8e25c16b041e5e3ca Mon Sep 17 00:00:00 2001 From: sideup66 <47700565+sideup66@users.noreply.github.com> Date: Thu, 30 Jun 2022 17:15:42 -0400 Subject: [PATCH] Start cron Starts cron at system start and also sets hosts file to help avoid a DNS bug due to a potential bug in the wyzecam firmware by pulling the ip address automatically on startup rather than depending on a pre determined entry. This will address any change in IP the url may experience for whatever reason. Any connection interruption or issue caused by this can also be rectified by simply rebooting your camea. --- SD_ROOT/wz_mini/etc/crontab/start_cron.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 SD_ROOT/wz_mini/etc/crontab/start_cron.sh diff --git a/SD_ROOT/wz_mini/etc/crontab/start_cron.sh b/SD_ROOT/wz_mini/etc/crontab/start_cron.sh new file mode 100644 index 0000000..2e0f28d --- /dev/null +++ b/SD_ROOT/wz_mini/etc/crontab/start_cron.sh @@ -0,0 +1,12 @@ +#!/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