#! /bin/bash cd "$(dirname "$0")" . opts.sh name=distccd [ -z "$host" ] && { echo "Host should be specified"; exit 1; } online=$(../scripts/ping.pl "$host") healthy=$(../scripts/ping.pl "$host:3632") function qssh { ssh "root@$host" "$@" } if [ $online -eq 1 ]; then id=$(qssh docker ps -f "'name=$name'" --format "'{{ .ID }}'" 2>/dev/null) status=$(qssh docker ps -f "'name=$name'" --format "'{{ .Status }}'" 2>/dev/null) [ $? -ne 0 ] && status="" fi if [ -n "$id" -a $healthy -eq 1 ]; then stat=$(qssh docker stats --no-stream $id | sed '1d' | awk '{ print $2 " " $3 " " $4 }') fi if [ -n "$status" -o -n "$stat" ]; then msg="DistCC: " [ -n "$stat" ] && msg+=" $stat" [ -n "$status" ] && msg+=" $status" else msg="" fi echo "$online $healthy $msg"