Update scripts and deploy with gnu stow
This commit is contained in:
12
stow/usr/share/smartmontools/smartd_warning.d/99-smartd-notify-all
Executable file
12
stow/usr/share/smartmontools/smartd_warning.d/99-smartd-notify-all
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# Notify all users on S.M.A.R.T errors
|
||||
# Place in /usr/share/smartmontools/smartd_warning.d/ or use "DEVICESCAN -m @smartd-notify-all" in /etc/smartd.conf
|
||||
# Copyright 2021-2025 Bryan C. Roessler
|
||||
# Licensed under the Apache License, Version 2.0
|
||||
IFS=$'\n'
|
||||
for LINE in $(w -hs); do
|
||||
USER=$(echo "$LINE" | awk '{print $1}')
|
||||
USER_ID=$(id -u "$USER")
|
||||
DISP_ID=$(echo "$LINE" | awk '{print $8}')
|
||||
sudo su "$USER" DISPLAY="$DISP_ID" DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"$USER_ID"/bus notify-send "S.M.A.R.T Error ($SMARTD_FAILTYPE) $SMARTD_MESSAGE" --icon=dialog-warning
|
||||
done
|
||||
Reference in New Issue
Block a user