Run script if Wireguard tunnel up/down

Is there a way to run a script once a Wireguard tunnel has been established or is not working anymore?

Or do I have to run a script periodically (e.g., each minute) which takes certain action depending on whether or not some IP on the other side of the tunnel is accessible?


Have a look at the watchcat package. It has options to restart interfaces when ping monitoring fails, and other monitoring/reaction options.