Hello just after some ideas for how to run a script after making a connection using wifi-connect using python/bash command etc using a raspberry pi 3, buster
Currently, I have set up a bash command that checks connectivity on loop and executes wifi-connect if not found
In addition, I have a service script that waits for a network connection and starts a separate python script that I need to start each time the unit starts.
If starting the system with no connection wifi connect boots up and connects, however, the service script seems to kick off when the initial client network is created and doesn’t kick off after the initial connection is made again.
Likewise, if the network was already known, wifi-connect remembers the credentials and the script runs ok.
New to python so scratching my head trying to think of a way to only start the script after wifi-connect is confirmed to have found the network. but also not repeat its self every time my current script loops.
#!/bin/sh -e freq=30 sleep 15 while [[ true ]]; do echo "Checking internet connectivity ..." wget --spider --no-check-certificate 220.127.116.11 > /dev/null 2>&1 if [ $? -eq 0 ]; then echo "Your device is already connected to the internet." echo "Skipping setting up Wifi-Connect Access Point. Will check again in $freq seconds" else echo "Your device is not connected to the internet." echo "Starting up Wifi-Connect.\n Connect to the Access Point and configure the SSID and Passphrase for the network to connect to." python3 /home/pi/iow/wifiSetup/wifi.py fi sleep $freq done