Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/sgrtye/Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrtye committed Jan 2, 2024
2 parents 76faddc + 90b5bfc commit 56053bf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions submanager/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ def generate_check_config(locations, uuid, host, path, save_path):
with open(save_path, "w", encoding="utf-8") as file:
file.write(config_content)


def update_client_config(locations, providers, credentials):
def remove_old_client_config():
directory_path = os.path.join(DIRECTORY_PATH, "conf")
if os.path.exists(directory_path):
shutil.rmtree(directory_path)
Expand All @@ -164,6 +163,7 @@ def update_client_config(locations, providers, credentials):
"Old client config files removed",
)

def update_client_config(locations, providers, credentials):
for client in credentials:
name, uuid, host, path = (
client["name"],
Expand Down Expand Up @@ -237,7 +237,7 @@ def update_nginx_config(credentials):
)


def update(nginx=False):
def update(nginx=False, remove_old_file=False):
try:
locations = get_location_ip()
providers = get_provider_ip()
Expand All @@ -253,6 +253,9 @@ def update(nginx=False):
if nginx:
update_nginx_config(credentials)

if remove_old_file:
remove_old_client_config()

update_client_config(locations, providers, credentials)

except Exception as e:
Expand All @@ -261,7 +264,7 @@ def update(nginx=False):


if __name__ == "__main__":
update(nginx=True)
update(nginx=True, remove_old_file=True)

schedule.every().day.at("00:00").do(update)
schedule.every().day.at("06:00").do(update)
Expand Down

0 comments on commit 56053bf

Please sign in to comment.