-
Notifications
You must be signed in to change notification settings - Fork 0
/
ark_force_update_mods.py
36 lines (28 loc) · 986 Bytes
/
ark_force_update_mods.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import time
from random import choice
from ark_manager import *
from paths import ARK_MODS_DIR
import os, shutil
from locks import Lock
from debug import get_logger
log = get_logger("ark_mods_updater")
import argparse
parser = argparse.ArgumentParser(description='Restart ark server.')
parser.add_argument("--message", dest='message', default=None, help="Message to add to broadcast, usually reason for restart.")
args = parser.parse_args()
if args.message:
args.message = args.message.strip()
if not args.message.endswith("."):
args.message = args.message + ". "
else:
args.message = args.message + " "
def force_update_mods():
log.info("Admin initialized force update mods.")
stop_server()
active_mods = get_active_mods()
log.info(f"Updating mods: {active_mods}")
update_mods(active_mods)
fix_mods_permissions()
start_server()
if __name__ == "__main__":
run_with_lock(force_update_mods, message="Force update mods.")