If every application-vm and VPN-dispVM has shut down, there is no need to keep VPN-vm running. It is just wasting memory.
Is there a way to trigger an automatic shutdown of VPN-vm once there are no application-vms or VPN-dispVMs running, the way VPN-vm starts automatically as soon as any application-vm does?
However, it’s trivial to set up a cron job running every 2 minutes (or 3… or 5… or even, 1 minute) to check if any qube is using your VPN-vm as its NETVM
Along the lines of: qvm-ls --running --fields netvm --raw-data | grep -q "VPN-vm" || qvm-shutdown --force --quiet "VPN-vm"
This will shut down VPN-vm if no qube uses it.
Note that I would personally run this every 5 minutes to avoid unnecessary shutdowns and re-starts of the VPN-vm when it’s unused for short periods of time.
Note2: it can be done in a more complicated way, with xl hooks, to touch a file which records the exact time when the last qube is shut down… but not worth the effort, imho.