Run a comamnd after network-online.target is ready

tl;dr: Use this shell command in my crontab: @reboot sh -c "while ! systemctl status network-online.target > /dev/null; do sleep 1; done; exec /foo/bar.sh" The problem I've encountered is, sometimes /foo/bar.sh would failed at boot. After digging into details, I found it's because the network was not ready, therefore the script could not get network …