I have the following script:
#!/bin/sh
notificationMessage="Your session is going to expire soon"
if [ $# == 2 ]; then
notificationMessage="Your session is going to expire in $2 hour"
fi
# echo "$notificationMessage"
sudo -u userA notify-send "Session Expiration Notification" "$notificationMessage" -u normal -t 10000
When I run the above script from a terminal (logged in as remoteUser), userA is able to see the notification on the screen. However, if the script is executed from a service (run as remoteUser), the notification is not shown to userA.
Where am I doing things wrong?
Note: remoteUser has sudo
privilege