0

I am detecting IP assigned by dhclient and trying to show it using notify-send. I have made a script and placed it in /etc/dhcp/dhclient-exit-hooks.d. Content of the script is as below

#!/bin/bash
whoami >>/tmp/vari.txt
echo "========================>" >> /tmp/vari.txt
printenv >> /tmp/vari.txt
echo "========================>" >> /tmp/vari.txt
set >> /tmp/vari.txt
notify-send "hey"
MAINUSER=`cat /etc/passwd|grep 1000|sed "s/:.*$//g"`
su $MAINUSER -c $"notify-send \"IP assigned\""

I have saved it with name test and have given executable permission and root as owner. All the parts of the scripts are working except for notify-send. One thing I checked is keeping filename as test.sh and notify-send works from command line but dispatcher service doesn't execute it.

Can someone suggest a solution?

0 Answers0