updated scripts
This commit is contained in:
parent
2a7bd2c250
commit
5b03adaaa9
3 changed files with 16 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
||||||
.env
|
.env
|
||||||
|
server-scripts/desec/public_ip
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ import subprocess
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from time import sleep
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
import urllib3
|
||||||
|
|
||||||
load_dotenv() # Loads up .env file
|
load_dotenv() # Loads up .env file
|
||||||
|
|
||||||
|
|
@ -86,8 +88,19 @@ async def newIPCheck():
|
||||||
getCurrentIP() # update current ip
|
getCurrentIP() # update current ip
|
||||||
await newIPCheck()
|
await newIPCheck()
|
||||||
|
|
||||||
|
def waitForConnection():
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
response = urllib3.request("GET", "https://ifconfig.me")
|
||||||
|
return
|
||||||
|
except urllib3.exceptions.MaxRetryError:
|
||||||
|
print("Failed connection!")
|
||||||
|
sleep(1)
|
||||||
|
pass
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
waitForConnection()
|
||||||
|
|
||||||
if not os.path.exists("public_ip"):
|
if not os.path.exists("public_ip"):
|
||||||
getCurrentIP()
|
getCurrentIP()
|
||||||
elif not os.path.exists(".env"):
|
elif not os.path.exists(".env"):
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
if [ ! -d .venv ]; then
|
if [ ! -d .venv ]; then
|
||||||
python3 -m venv .venv
|
python3 -m venv .venv
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
pip install -U python-dotenv
|
pip install -U python-dotenv urllib3
|
||||||
pip install --upgrade pip # Update pip to the latest version
|
pip install -U pip # Update pip to the latest version
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo 'Make sure to run ". .venv/bin/activate" to enter the development environment'
|
echo 'Make sure to run ". .venv/bin/activate" to enter the development environment'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue