-
Notifications
You must be signed in to change notification settings - Fork 9
How to Auto Reconnect with Supervisor
Encho edited this page Dec 9, 2023
·
6 revisions
Using Supervisor, we can have robust autorestarting of the script to let us achieve high uptime despite crashes, disconnects, and all other interruptions just short of the proxy's machine crashing. (Though, if you're running 2Based2Wait on a server, you can just schedule a CRON job to survive even that.)
To get the proxy to autoreconnect, do the following:
- Install Supervisor globally with
pnpm install supervisor -g
- Start the proxy with Supervisor. You have two options:
- Option 1:
pnpm run supervisor
- The proxy will only restart when the program exits with an exit code of 1, which it does when it wants to autoreconnect. This means that if the proxy crashes in an unexpected way, it might not autoreconnect and it'll need manual intervention to restart it.
- Option 2:
pnpm run supervisorAllGasNoBrakes
- The proxy will restart whenever the program exits. Use this robust setup for 24/7/365 uptime, but only after you're incredibly certain that your config is actually working. When set up this way the proxy will never need manual intervention outside of maintaining the actual machine it's running on.
Tip: Autoreconnect should be one of the last things you enable. Make sure your config is working before turning it on, or you'll end up with a constantly restarting script!