I have a script that sets my proxy automatically depending upon the connection and so its placed in /etc/network/if-up.d/ folder. I set the proxy using gsettings tool and then I want to show a notification on the desktop.
I use notify OSD as follows:
notify-send -u 'critical' -i /home/vivek/Downloads/proxy.ico 'SetProxy Status' 'proxy set to auto'
The script runs fine because i tried to print some log messages into a file which suggest that the script is being run, But i do not see any visible changes when i check my proxy settings, System Settings->Network Proxy, I see that the proxy is unchanged although it has changed actually[I checked the browser and the proxy settings were applied], Also I see no notification.
Amazingly if i run the script explicitly as follows:
cd /etc/network/if-up.d/
sudo ./setproxy
I see the notification at once and also the changes are reflected in Network Proxy settings. Why does this happen? How can I fix this? I am on a ubuntu 12.04 system.

export DISPLAY=:0at the beginning of the script might help you with making the notifications visible – Glutanimate Dec 30 '12 at 21:56