diff --git a/imageroot/update-module.d/10fix_NextFpmPort b/imageroot/update-module.d/10fix_NextFpmPort index 1f01ad6..934f4df 100755 --- a/imageroot/update-module.d/10fix_NextFpmPort +++ b/imageroot/update-module.d/10fix_NextFpmPort @@ -27,6 +27,10 @@ import sys directory = "databases/vhosts/" output_file = "databases/NextFpmPort" +# no vhosts, no need to continue +if not os.path.exists(output_file): + sys.exit(0) + # Find all .ini files ini_files = [f for f in os.listdir(directory) if f.endswith('.ini')] @@ -49,12 +53,11 @@ except: # Read the current value from the NextFpmPort file if it exists current_id = None -if os.path.exists(output_file): - with open(output_file, "r") as f: - try: - current_id = int(f.read().strip()) - except ValueError: - current_id = None +with open(output_file, "r") as f: + try: + current_id = int(f.read().strip()) + except ValueError: + current_id = None # Write the last ID only if it's greater than the current value if current_id is None or last_id > current_id: