gluetun icon indicating copy to clipboard operation
gluetun copied to clipboard

Feature request: Run command when tunnel comes up and when tunnel goes down

Open qdm12 opened this issue 3 years ago • 5 comments

What's the feature? 🧐

Run a list of commands read from files:

  • /gluetun/vpn-start-commands.txt
  • /gluetun/vpn-stop-commands.txt

For example it could be:

/bin/sh -c "/shellscript.sh"
/bin/iptables -L

Note the absolute paths which are necessary (especially when later moving to an image without shell).

Optional extra information 🚀

  • This is to replace shell scripts since the shell might disappear in a near future when moving to a scratch image.
  • The Go program would run the commands for you (instead of OpenVPN or Wireguard)
  • When #588 is done, I will add documentation on how to bind mount binaries to run like sh if you want it.

qdm12 avatar Sep 13 '21 14:09 qdm12

Hi there, firstly thanks so much for your work on gluetun! Just wondering if there had been any progress on this, or if it can be solved in another way?

frasderp avatar Jan 13 '23 22:01 frasderp

Is there any workaround known to run a script automatically?

Merrit avatar Nov 05 '23 18:11 Merrit

I'd love for this to be implemented

realAbitbol avatar Nov 18 '23 14:11 realAbitbol