Update template with copilot

This commit is contained in:
ChenKaiLiuG
2025-11-17 00:11:21 +08:00
parent 5b130bc9d7
commit f98f53e83f
4 changed files with 96 additions and 99 deletions

1
sh/ollama-monitor.sh Normal file
View File

@@ -0,0 +1 @@
#!/bin/bash echo "Starting Ollama monitor service..." # 無限迴圈來持續監控 while true; do # 檢查 ollama 服務的日誌,看看最近是否有新請求或活動 # 'tail -n 1' 抓取最新的日誌行 # 'grep -E' 搜尋包含 'generating' 或 'loading' 的行,代表有活動 if docker logs ollama --since 2m 2>&1 | grep -E -q 'generating|loading'; then echo "$(date) - Ollama is active. Not unloading models." # 如果有活動,等待 1 分鐘後再次檢查 sleep 60 else # 如果 10 分鐘內沒有活動,執行卸載指令 echo "$(date) - Ollama is idle. Unloading models..." docker exec ollama ollama unload -a echo "$(date) - Models unloaded." # 等待 1 分鐘後再次檢查 sleep 60 fi done

0
sh/vllm-monitor.sh Normal file
View File