initial commit
This commit is contained in:
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check GPU status in Jellyfin container
|
||||
output=$(docker exec jellyfin nvidia-smi 2>&1)
|
||||
exit_code=$?
|
||||
|
||||
# Log file location
|
||||
LOG_FILE="/opt/docker/jellyfin/jellyfin-monitor.log"
|
||||
|
||||
# Check if command failed or output contains "error" (case insensitive)
|
||||
if [ $exit_code -ne 0 ] || echo "$output" | grep -iq "error"; then
|
||||
echo "$(date): GPU error detected." | tee -a "$LOG_FILE"
|
||||
echo $output | tee -a "$LOG_FILE"
|
||||
echo "$(date): Restarting Jellyfin..." | tee -a "$LOG_FILE"
|
||||
cd /opt/docker/jellyfin/
|
||||
docker compose restart
|
||||
echo "$(date): Jellyfin restarted successfully" | tee -a "$LOG_FILE"
|
||||
else
|
||||
echo "$(date): GPU status OK"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user