import subprocess import sys import os def main(): venv_python = "/home/roni/LocalFoodAI/venv/bin/python3" log_file = "/home/roni/LocalFoodAI/server.log" main_py = "/home/roni/LocalFoodAI/main.py" # Check if files exist if not os.path.exists(venv_python): print(f"Error: Python venv not found at {venv_python}") sys.exit(1) if not os.path.exists(main_py): print(f"Error: main.py not found at {main_py}") sys.exit(1) print(f"Starting main.py with daemon wrapper...") f = open(log_file, "a") subprocess.Popen([venv_python, main_py], stdout=f, stderr=f, start_new_session=True, cwd="/home/roni/LocalFoodAI") print("Daemon successfully spawned main.py process.") if __name__ == "__main__": main()