Files
webgui/emhttp/plugins/dynamix.docker.manager/nchan/docker_load
2025-02-04 14:28:24 -08:00

14 lines
380 B
Bash
Executable File

#!/bin/bash
while :; do
output=$(docker stats --no-stream --format='{{.ID}};{{.CPUPerc}};{{.MemUsage}}' 2>&1)
if [[ $? -ne 0 ]]; then
logger -t webgui "docker stats error: $output"
exit 1
fi
if [[ -n "$output" ]]; then
curl -sfd "$output" --unix-socket /var/run/nginx.socket http://localhost/pub/dockerload?buffer_length=1 >/dev/null 2>&1
fi
sleep 1
done