1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-08 21:21:06 +00:00
AdvLabDB/scripts/server_setup.py

23 lines
536 B
Python
Raw Normal View History

2022-05-03 17:02:39 +00:00
#!/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}")