1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-12 21:40:41 +00:00
AdvLabDB/scripts/server_setup.py
2022-05-03 19:02:39 +02:00

22 lines
536 B
Python

#!/usr/bin/env python3
import sys
from pathlib import Path
script_dir = Path(__file__).parent.absolute()
sys.path.insert(0, str(script_dir))
from shared import run
logs_dir = Path("/var/log/advlabdb/")
# Create logs directory
run(f"sudo mkdir -v -p {logs_dir}")
run(f"sudo chown -R admin:admin {logs_dir}")
logged_server_setup_script = script_dir / "logged_server_setup.py"
log_file = logs_dir / "server_setup.log"
# Start actual server setup script with logging
run(f"python3 -u {logged_server_setup_script} | tee {log_file}")