1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-12-20 23:41:20 +00:00
AdvLabDB/advlabdb/scripts/setup/server_setup.py
2022-07-03 18:26:15 +02:00

29 lines
688 B
Python

"""
No relative imports allowed in this file to be able to run server_setup.py without packages.
"""
import sys
from pathlib import Path
from shared import LOGS_DIR, REPO_DIR
sys.path.insert(0, str(Path(__file__).parent.parent.absolute()))
from terminal_utils import run
def main():
# Create logs directory
run(f"sudo mkdir -v -p {LOGS_DIR}")
run(f"sudo chown -R admin:admin {LOGS_DIR}")
log_file = LOGS_DIR / "server_setup.log"
# Start actual server setup script with logging
run(
f"python3 -u /home/admin/advlabdb/advlabdb/scripts/setup/logged_server_setup.py | tee {log_file}",
cwd=REPO_DIR,
)
if __name__ == "__main__":
main()