user level NetworkManager dispatcher

2008-07-06T00:02:58Z
/tags/linux, /tags/networking

Like several people out there, I wanted to have user (non-root) scripts run when NM changed state.

I decided to write a quick python script to snoop the dbus, and call a function when an interface is brought up or down. Maybe somebody else will find this useful.

Instead of a director of scripts, just place a file called .nmdispatchrc in the home directory, containing python code which defines functions ifup and ifdown. e.g.

:def ifup(interface,*args)

   print 'interface '+interface 'brought up'

:def ifdown(interface,*args)

   print 'interface '+interface+ ' brought down'

The actual daemon is only slightly longer than the MIT license it is distributed under. You are looking at the only known documentation. You will need dbus-python