diff options
Diffstat (limited to 'bin/notify.sh')
| -rwxr-xr-x | bin/notify.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/notify.sh b/bin/notify.sh new file mode 100755 index 0000000..9271b67 --- /dev/null +++ b/bin/notify.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -o nounset +set -o errexit +set -o pipefail + +readonly PROGNAME="$(basename "${0}")"; +readonly PROGDIR="$(readlink -m "$(dirname "${0}")")"; +readonly ARGS="${@}"; + +function main() +{ + local username="${1}"; shift; + local message="${@}"; + local userid=$(id -u "${username}"); + sudo -u ${username} \ + DISPLAY=":0" \ + DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${userid}/bus" \ + notify-send -u critical -a IT "Message from tech" "${message}" +} + +main ${ARGS} +exit 0 |
