user level dispatcher for NM



Hi All;

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'

you will need dbus-python

Attachment: user-nm-dispatch.py
Description: Binary data







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]