I have the following script that I need to run on my Synology NAS at boot-up. The Synology NAS has built-in scheduled tasks with the ability to trigger tasks at boot-up.
The script I need to run is this:
#!/bin/sh ip link add macvlan0 link eth0 type macvlan mode bridge ip addr add 192.168.0.240/32 dev macvlan0 ip link set macvlan0 up ip route add 192.168.0.240/28 dev macvlan0
However, this does not work, the task seems to trigger to soon when the
eth0 interface is not yet ready to accept these commands.
sleep 60 before all
ip * commands, solves the issue. But it doesn't feel right to wait an arbitrary amount of seconds before doing my thing.
Given my requirements above, what's the best method to wait for the
eth0 interface to be available so that I can execute
ip * commands?