mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-06-28 04:06:54 +00:00
Update telegram-notifier.sh
This commit is contained in:
parent
a8c47e8e5e
commit
cccd2eb4c3
@ -897,22 +897,14 @@ capture_journal_events() {
|
|||||||
|
|
||||||
# System shutdown (NON-CRITICAL - with interval)
|
# System shutdown (NON-CRITICAL - with interval)
|
||||||
if [[ "$system_shutdown" -eq 1 ]] && (( current_time - last_shutdown_notification > resource_interval )); then
|
if [[ "$system_shutdown" -eq 1 ]] && (( current_time - last_shutdown_notification > resource_interval )); then
|
||||||
if [[ "$line" =~ "systemd" && ( "$line" =~ "Shutting down" || "$line" =~ "Powering off" || "$line" =~ "Rebooting" || "$line" =~ "Reached target Shutdown" || "$line" =~ "Stopping User Manager" ) ]]; then
|
if [[ "$line" =~ "systemd-journald" && "$line" =~ "Journal stopped" ]]; then
|
||||||
|
|
||||||
# Try to detect shutdown reason (if message includes it)
|
# No hay razón específica, pero podemos indicar que se detuvo el journal (lo último antes del apagado)
|
||||||
reason=""
|
send_notification "⚠️ $(translate "System is shutting down")"
|
||||||
if [[ "$line" =~ "Rebooting" ]]; then
|
|
||||||
reason=" ($(translate "System is rebooting"))"
|
|
||||||
elif [[ "$line" =~ "Powering off" ]]; then
|
|
||||||
reason=" ($(translate "System is powering off"))"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Format and send the notification
|
|
||||||
send_notification "⚠️ $(translate "System is shutting down")$reason"
|
|
||||||
last_shutdown_notification=$current_time
|
last_shutdown_notification=$current_time
|
||||||
|
|
||||||
# Log the event
|
# Log the event
|
||||||
logger -t proxmox-notify "System is shutting down$reason"
|
logger -t proxmox-notify "System is shutting down (journal stopped)"
|
||||||
|
|
||||||
event_processed=true
|
event_processed=true
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user