I have just succeeded to auto-mount NFS after having connected VPN and auto-unmount before discconect with Tunnelblick (3.7.3 on macOS High Sierra).
At first, I had the same problem with Cameron Conner. Still, Studer's answer was quite helpful for me.
Instead of Studer's client.(up|down).osx.sh, I placed two lines in the .ovpn:
up (path to your connected.sh)
down (path to your pre-disconnect.sh)
Then create and edit these connected.sh and pre-disconnect.sh.
connected.sh:
#!/bin/sh
sudo mkdir /Volumes/NFS
sudo mount -P 192.168.0.1:/share /Volumes/NFS
pre-disconnect.sh:
#!/bin/sh
sudo umount /Volumes/NFS
I don't know about TimeCapsule manipulation. So above process is about NFS. I think you can arrange it for TimeCapsule.
I think the point Cameron and I got stucked was su or sudo. And, to avoid password is another problem. My solution to that was sudoers.
Edit /etc/sudores with visudo. Modify the %admin entry from:
%admin ALL=(ALL) ALL
to:
%admin ALL=(ALL) NOPASSWD:ALL
Unless your account is not an admin, it should work.