Init
This commit is contained in:
26
auto-boot-ollama-pc.sh
Executable file
26
auto-boot-ollama-pc.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# ========= Configuration =========
|
||||
CONTAINER_NAME="paperless-ai"
|
||||
OLLAMA_HOST="192.168.222.12"
|
||||
OLLAMA_PORT="11434"
|
||||
ERROR_PATTERN="Error: \[ERROR\] Document analysis failed: connect EHOSTUNREACH $OLLAMA_HOST:$OLLAMA_PORT"
|
||||
|
||||
# Tools (adjust if your distro uses different names)
|
||||
WOL_CMD="wakeonlan" # or "etherwake -i eth0 $WOL_MAC"
|
||||
NC_CMD="nc" # netcat
|
||||
DOCKER="docker"
|
||||
|
||||
log() { printf '[%(%F %T)T] %s\n' -1 "$*"; }
|
||||
|
||||
${DOCKER} logs -f --since 0s "${CONTAINER_NAME}" 2>&1 | \
|
||||
while IFS= read -r line; do
|
||||
# Print lines optionally for debugging:
|
||||
#echo "$line"
|
||||
|
||||
if echo "$line" | grep -qE "${ERROR_PATTERN}"; then
|
||||
log "Detected EHOSTUNREACH for Ollama (${OLLAMA_HOST}:${OLLAMA_PORT})."
|
||||
fi
|
||||
|
||||
done
|
||||
Reference in New Issue
Block a user