Lots of changes

This commit is contained in:
2021-10-22 14:55:52 -04:00
parent f59e3d70e7
commit a188ea73a3
17 changed files with 1861 additions and 185 deletions

View File

@@ -3,10 +3,14 @@
# Place in /usr/share/smartmontools/smartd_warning.d/ or use "DEVICESCAN -m @smartd-notify-all" in /etc/smartd.conf
# Copyright 2021 Bryan C. Roessler
[[ -f functions ]] && . functions || exit 1
is_root
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 -u "$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
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