#!/bin/bash # # Script apelat de upssched pentru a gestiona evenimentele UPS # LOGFILE=/var/log/ups-events.log log_event() { echo "[2025-10-06 20:03:38] $1" >> $LOGFILE } case $1 in onbatt) log_event "UPS EVENT: Pe baterie de 3 minute - Începe shutdown orchestrat" logger -t upssched-cmd "UPS on battery for 3 minutes - starting orchestrated shutdown" /usr/local/bin/ups-shutdown-cluster.sh & ;; lowbatt) log_event "UPS EVENT: BATERIE SCĂZUTĂ - Shutdown IMEDIAT" logger -t upssched-cmd "UPS LOW BATTERY - immediate shutdown" /usr/local/bin/ups-shutdown-cluster.sh & ;; commbad) log_event "UPS EVENT: Comunicație pierdută cu UPS de 30 secunde" logger -t upssched-cmd "Lost communication with UPS for 30 seconds" # Nu facem shutdown automat pentru pierdere comunicație ;; *) log_event "UPS EVENT: Eveniment necunoscut - $1" logger -t upssched-cmd "Unknown UPS event: $1" ;; esac