File size: 724 Bytes
2126d64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import subprocess
import threading

def start_backup_service():
    proc = subprocess.Popen(
        ["python3", "/backup.py"],
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
        text=True,
        bufsize=1
    )
    # Stream logs in real-time
    for line in proc.stdout:
        print("[Backup]", line.strip())

print("Starting Restorer.")
subprocess.run(["python3", "/restore.py"], check=True)
print("Finished.")

print("Starting Auto-Backup Service.")
thr = threading.Thread(target=start_backup_service, daemon=True)
thr.start()

print("Starting Coder server.")
subprocess.run([
    "code-server",
    "--bind-addr", "0.0.0.0:7860",
    "--auth", "none",
    "/home/vscode/workspace"
])