forked from balena-os/wifi-connect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
executable file
·34 lines (25 loc) · 802 Bytes
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
# Enable i2c - needed for sensors
modprobe i2c-dev
modprobe w1-gpio && modprobe w1-therm
export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket
# Choose a condition for running WiFi Connect according to your use case:
# 1. Is there a default gateway?
# ip route | grep default
# 2. Is there Internet connectivity?
# nmcli -t g | grep full
# 3. Is there Internet connectivity via a google ping?
# wget --spider http://google.com 2>&1
# 4. Is there an active WiFi connection?
iwgetid -r
if [ $? -eq 0 ]; then
printf 'Skipping WiFi Connect\n'
else
printf 'Starting WiFi Connect\n'
./wifi-connect
fi
# Start your application here.
printf 'Starting pigpiod\n'
pigpiod
printf 'Starting core.py\n'
cd astroplant-kit/astroplant_kit && python core.py