How to autostart VPN?

I’ve followed the qubes docs on setting up a proxyVM using network manager. However, the autoconnect script included there doesn’t work.

What, and where do I have to write a .sh script?

Did you try something like

qvm-run -q -a --service -- proxyVM qubes.StartApp+whatever-service-you'd-like-to-start-in-it

set in dom0’s Session and Startup? No scripting, thus more secure-wise.

Service in a proxyVM has to have a .desktop file configured.

Further readings