I am running Kubuntu 12.10 64bit. I am trying to get a bash script to execute when I am disconnected from the network. I created a file in the folder /etc/network/if-down.d/
called test
which has a single line:
zenity --info --text="network down!"
I can execute this script without any issues; typing /etc/network/if-down.d/test
into my terminal causes a message box to pop up saying "network down!". When I disconnect from my wifi network via the network manager, nothing happens. Unplugging my wifi usb dongle does not cause the message box to appear either. My only guess is that for what ever reason scripts in /etc/network/if-down.d/
are not being executed. Adding #!/bin/bash
as the first line didn't work either.
EDIT: 2013-01-02
I had some issues using gertvdijk's answer (old edits and comments getting mixed up) which are now sorted out. Running zenity
with su
and DISPLAY=:0
solved my problem.