1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-12 21:40:41 +00:00
AdvLabDB/advlabdb/scripts/setup/server_setup.py

30 lines
688 B
Python
Raw Normal View History

2022-07-03 16:26:15 +00:00
"""
No relative imports allowed in this file to be able to run server_setup.py without packages.
"""
2022-05-17 09:58:19 +00:00
import sys
2022-05-17 10:04:56 +00:00
from pathlib import Path
2022-05-17 09:58:19 +00:00
from shared import LOGS_DIR, REPO_DIR
2022-05-17 10:09:54 +00:00
sys.path.insert(0, str(Path(__file__).parent.parent.absolute()))
2022-05-17 09:58:19 +00:00
from terminal_utils import run
2022-05-08 15:29:45 +00:00
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
2022-05-09 23:26:58 +00:00
run(
2022-05-17 10:12:52 +00:00
f"python3 -u /home/admin/advlabdb/advlabdb/scripts/setup/logged_server_setup.py | tee {log_file}",
2022-05-09 23:26:58 +00:00
cwd=REPO_DIR,
)
2022-05-08 15:29:45 +00:00
if __name__ == "__main__":
main()