26 lines
1.1 KiB
Python
Executable File
26 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import os, subprocess
|
|
|
|
TARGET_PATH = "/home/alex/Scripts/"
|
|
|
|
def iterate_in_directory(path):
|
|
|
|
for fname in os.listdir(path):
|
|
|
|
parent_path = os.path.join(path, fname)
|
|
if os.path.isdir(parent_path) and ("docker-compose.yml" in os.listdir(parent_path) or ("docker-compose.yaml" in os.listdir(parent_path))):
|
|
print("Updating " + parent_path)
|
|
os.chdir(parent_path)
|
|
subprocess.run(["docker-compose", "down"], check=True, stderr = subprocess.STDOUT)
|
|
subprocess.run(["docker-compose", "pull"], check=True, stderr = subprocess.STDOUT)
|
|
subprocess.run(["docker-compose", "up", "-d"], check=True, stderr = subprocess.STDOUT)
|
|
|
|
elif (fname == "bitwarden"):
|
|
print("Updating bitwarden instance")
|
|
os.chdir(parent_path)
|
|
subprocess.run(["./bitwarden.sh", "updateself"], check=True, stderr = subprocess.STDOUT)
|
|
subprocess.run(["./bitwarden.sh", "update"], check=True, stderr = subprocess.STDOUT)
|
|
|
|
|
|
iterate_in_directory(TARGET_PATH) |