#!/bin/bash

SERVICES=("service1" "service2" "service3" "service4" "service5" 
          "service6" "service7" "service8" "service9" "service10")

for service in "${SERVICES[@]}"; do
    if ! systemctl is-active --quiet "$service"; then
        echo "$(date): Сервис $service не работает. Перезапуск..."

        systemctl restart "$service"
        systemctl start "service-failure-watcher@${service}.timer"

        echo "$(date): Таймер для $service активирован"
    fi
done