I’m trying to set up a custom script that runs on login, but only after the network is fully up (I’m syncing a few dotfiles from a private Git repo).
I added the script to my Openbox autostart, but it sometimes runs before Wi-Fi connects, which causes it to fail.
Any suggestions for a lightweight way to delay execution until the system confirms an active network connection? Maybe using nmcli or something in the Mabox toolkit?
I ended up using a simple loop with nmcli to check for an active connection before running the script. Added this to my autostart instead of calling the sync script directly:
while ! nmcli -t -f STATE g | grep -q "connected"; do
sleep 2
done
~/.config/scripts/sync-dotfiles.sh
It’s lightweight, reliable, and does exactly what I needed. Appreciate your support!