We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

wait for network before running script?



  • is it possible to detect when the network is up? I need to run a script in rc.local
    but it needs to have the network connected (either Access point, or connected to my home network) first.

    TIA



  • @Ian-Steele you can use a hotplug script. The script gets run what x event occurs on x device. Here is an example of a hotplug script my IoT device runs when the wan inteface comes up. Note the file location.

    #!/bin/bash

    File: 50-ipsetup

    Author: chris

    Created on 24 Jun. 2019, 1:07:07 am

    #!/bin/sh

    Place me in /etc/hotplug.d/iface/50-ipsetup

    WIFI_INTERFACE="wwan"

    echo "Starting interace hotplug ${DEVICE} Action: ${ACTION} Interface: ${INTERFACE}" >> /tmp/cblog
    if [ "$ACTION" = "ifup" -a "$INTERFACE" = "wwan" ]; then
    echo "IFUP ${DEVICE}" >> /tmp/cblog
    echo "Run ip setup script for device: ${DEVICE}" >> /tmp/cblog
    echo "listen $(ip -o -4 a s apcli0 | awk '{ print $4 }' | cut -d/ -f1):80;" > /etc/nginx/listen_ip
    fi



  • Thanks Chris - I was not aware of the hotplug stuff. omega2 is pretty slow to boot
    up for a little openWrt device(1 min+)

    anyway I think I have something working so far.



  • @Ian-Steele the boot time for an Omega is effected by a range of factors, number of modules loaded, services to be started, network connection etc., sd card read, file system check etc. My Pi3 is no faster.

    Adding a script to rc.local I would consider a bit of a hack, hotplug was designed for the task you asked about, but actually hotplug is deprecated in favor of udev but I haven't tried udev on Omega/OpenWrt.


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.