Spyke
selfhost·Self Hosted - Self-hosting your services.byFerrous

Easiest way to automate a VPN refresh?

On my truenas scale machine, I have a container for gluetun and one for qbittorrent (among others). Maybe a couple times a week, I notice that the VPN connection gets flakey. Qbittorrent speeds go down into the kb/s range. This promps me to carry out an annoying, manual process:

  1. I pause all torrents in qbittorrent webui
  2. I stop both the qbit and gluetun containers
  3. I start the gluetun container
  4. I give the gluetun container adequate time to connect (since the qbit container depends on the gluetun network, attempting to start both at the same time yields an error on the qbit side)
  5. I start the qbit container
  6. I resume all torrents in the qbittorrent webui

Is there any easy way to automate this process? Preferably one that doesn't require me to learn ansible? I'm hoping the solution could all be done via portainer - which I use.

Thank you in advance.

View original on lemmy.ml
Ferrousreply
lemmy.ml

You're thinking i could make a bash script that pauses all torrents and a cronjob that restarts containers with some timing built in?

0

You could definitely do that. I use this to manage torrents from the command line and in scripts

2

Yeah. Example: if pings get flakey, or can't curl address, then restart all the things.

Doesn't need to stop torrents, just close the app, restart networking, and start it again.

0

I would investigate what is actually causing the connection to slow, but you can just run docker restart gluetun qbittorrent from cron or whatever.

2

Make sure everything starts automatically after a reboot, and reboot daily.

1

You reached the end