|
|
@ -10,16 +10,16 @@ local ollama_manager = {} |
|
|
|
|
|
|
|
|
-- Start Ollama service via SSH |
|
|
-- Start Ollama service via SSH |
|
|
function ollama_manager.start_service(config) |
|
|
function ollama_manager.start_service(config) |
|
|
utils.log("SSH is reachable. Starting ollama service...") |
|
|
utils.log("SSH is reachable. Starting Ollama service...") |
|
|
socket.sleep(10) |
|
|
socket.sleep(10) |
|
|
|
|
|
|
|
|
-- Start ollama service using nssm |
|
|
-- Start ollama service using nssm |
|
|
ssh.execute("nssm start ollama", config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE) |
|
|
ssh.execute("nssm start ollama", config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE) |
|
|
|
|
|
|
|
|
-- Alternative systemctl commands (commented out) |
|
|
-- Alternative systemctl commands (commented out) |
|
|
-- ssh.execute('wsl.exe -d Debian -- sudo systemctl enable ollama', config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE) |
|
|
-- ssh.execute('wsl.exe -d Debian -- sudo systemctl enable ollama', config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE) |
|
|
-- ssh.execute('wsl.exe -d Debian -- sudo systemctl start ollama', config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE) |
|
|
-- ssh.execute('wsl.exe -d Debian -- sudo systemctl start ollama', config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE) |
|
|
|
|
|
|
|
|
-- Wait for service to become available |
|
|
-- Wait for service to become available |
|
|
if network.port_is_up(config.OLLAMA_HOST, config.OLLAMA_PORT, 90) then |
|
|
if network.port_is_up(config.OLLAMA_HOST, config.OLLAMA_PORT, 90) then |
|
|
utils.log("Ollama service is reachable again.") |
|
|
utils.log("Ollama service is reachable again.") |
|
|
@ -34,14 +34,14 @@ end |
|
|
-- Stop Ollama service and shutdown host |
|
|
-- Stop Ollama service and shutdown host |
|
|
function ollama_manager.stop_service_and_shutdown(config) |
|
|
function ollama_manager.stop_service_and_shutdown(config) |
|
|
utils.log("Shutting down Ollama host to save power...") |
|
|
utils.log("Shutting down Ollama host to save power...") |
|
|
|
|
|
|
|
|
-- Stop ollama service using nssm |
|
|
-- Stop ollama service using nssm |
|
|
ssh.execute("nssm stop ollama", config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE) |
|
|
ssh.execute("nssm stop ollama", config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE) |
|
|
|
|
|
|
|
|
-- Alternative systemctl commands (commented out) |
|
|
-- Alternative systemctl commands (commented out) |
|
|
-- ssh.execute('wsl.exe -d Debian -- sudo systemctl disable ollama', config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE) |
|
|
-- ssh.execute('wsl.exe -d Debian -- sudo systemctl disable ollama', config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE) |
|
|
-- ssh.execute('wsl.exe -d Debian -- sudo systemctl stop ollama', config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE) |
|
|
-- ssh.execute('wsl.exe -d Debian -- sudo systemctl stop ollama', config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE) |
|
|
|
|
|
|
|
|
-- Shutdown the host |
|
|
-- Shutdown the host |
|
|
ssh.execute("shutdown.exe /s /t 0", config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE) |
|
|
ssh.execute("shutdown.exe /s /t 0", config.SSH_USER, config.OLLAMA_HOST, config.SSH_PORT, config.SSH_IDENTITY_FILE) |
|
|
socket.sleep(5) |
|
|
socket.sleep(5) |
|
|
|