Last active
March 12, 2024 01:30
-
-
Save kyouheicf/324a852ca913f03b544a04561a35095e to your computer and use it in GitHub Desktop.
run-multiple-replicas-on-the-same-windows-machine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rem set replica service name | |
set SC_NAME=Cloudflared2 | |
echo %SC_NAME% | |
rem set tunnel token | |
set TUN_TOKEN=eyJxxx | |
echo %TUN_TOKEN% | |
rem copy binary to another folder | |
xcopy /e /h /c /i "C:\Program Files (x86)\cloudflared" "C:\Program Files (x86)\%SC_NAME%" | |
rem create replica service | |
sc create %SC_NAME% ^ | |
binPath="\"C:\Program Files (x86)\%SC_NAME%\cloudflared.exe\" tunnel run --token %TUN_TOKEN%" ^ | |
DisplayName="%SC_NAME% agent" ^ | |
start=auto ^ | |
error=ignore | |
sc failureflag %SC_NAME% 1 | |
sc failure %SC_NAME% reset=86400 actions=restart/20000 | |
rem start replica service | |
net stop %SC_NAME% & net start %SC_NAME% | |
-- | |
rem update cloudflared.exe | |
rem "C:\Program Files (x86)\%SC_NAME%\cloudflared.exe" update --version 2024.2.0 | |
rem net stop %SC_NAME% & net start %SC_NAME% | |
--- | |
rem delete replica service | |
rem net stop "%SC_NAME%" & sc delete %SC_NAME% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment