Run script after OpenVPN connects successfully

I’m trying to run a script on boot e.g. curl >> /var/vpn_ip.log after OpenVPN establishes a connection. There’s an option

Shell commands executed when the instance is starting.

but it runs before the connection is established, and I see my public IP in the resulting log file. What are my options for running the script after the VPN connection is established?

I came across the option --client-connect <cmd> script hook:

The command is passed the common name and IP address of the just-authenticated client as environmental variables (see environmental variable section below). The command is also passed the pathname of a freshly created temporary file as the last argument (after any arguments specified in cmd ), to be used by the command to pass dynamically generated config file directives back to OpenVPN.

Then probably something like this(?):

services.openvpn.servers.<name>.config = ''
  client-connect /path/to/script

I can’t test this setup, so not sure if this is helpful at all.