You are not logged in.

#1 2010-12-29 13:37:54

os
Member
Registered: 2010-12-29
Posts: 6

dhcpcd hook problem: start python script within hook

Dear fellow Arch fans,

I'm encountering a rather annoying problem:
When I lose my internet connection my pidgin client doesn't get 'informed' about this and I won't receive IMs for an unspecified amount of time. I thought that I could work around this by myself, therefore I wrote two scripts in Python which connect/disconnect all active Pidgin-accounts using DBus. Both of them work fine. I also wrote a dhcpcd hook which should "listen" for a "NOCARRIER" and a "BOUND" reason which for itself also works fine (puts some output in a logfile).

The problem now is to invoke the python scripts from within the hook. My hook looks as follows:

lf='/var/log/myhook.log'

case $reason in
        NOCARRIER)
                echo "nocarrier branch" >> $lf
                sudo -u os python2 /usr/lib/dhcpcd/dhcpcd-hooks/\       
                        scripts/pidgin_dbus_discon.py >> $lf
                ;;
        BOUND)
                sudo -u os python2 /usr/lib/dhcpcd/dhcpcd-hooks/
                        scripts/pidgin_dbus_con.py >> $lf
                echo "bound branch" >> $lf
                ;;
        *)
                echo $reason >> $lf
                ;;
esac

A sample output from the logfile /var/log/myhook.log after two cable pulls looks like

nocarrier branch
CARRIER
bound branch
nocarrier
CARRIER
bound

But even on unsuccessful invocation the pidgin_dbus_con.py-script should at least print

con-script started
con-script finished

Does anyone have a clue what the problem might be here?
I would appreciate any help!

os

Last edited by os (2010-12-29 13:47:15)

Offline

Board footer

Powered by FluxBB