#!/bin/bash # dbanner-title-uk: Служби, що не працюють # dbanner-title-en: Services that are down # dbanner-mode: live # Enabled runit services that are not running; nothing when all of them are up. . "${0%/*}/lib.sh" dir=/var/service [[ -d $dir ]] || exit 0 down=() for s in "$dir"/*/; do s=${s%/} [[ -f $s/down ]] && continue state=$(timeout 1 sv status "$s" 2>/dev/null) || state=down [[ $state == run:* ]] || down+=("${s##*/}") done ((${#down[@]})) || exit 0 echo "$Bold$(say "Не працюють:" "Down:")$Off $Red${down[*]}$Off $(say "(dsv status)" "(dsv status)")"