Initial commit

This commit is contained in:
2021-10-16 15:06:07 -04:00
parent 9a839d6530
commit b2d495dadc
13 changed files with 663 additions and 0 deletions

12
smartd-notify-all Normal file
View 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 Bryan C. Roessler
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
done