aboutsummaryrefslogtreecommitdiffstats
path: root/bin/notify.sh
blob: 9271b672209a5774e928008ee8b448cdd773d087 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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