View Single Post
Posts: 175 | Thanked: 210 times | Joined on Mar 2013
#107
Hello

I know this thread is kind of old but I think that N900 Notifier is great combined with linux desktop. I have an issue though: I have to manually start it and kill it every time I need it. I want it to automatically start when I connect to my home wlan and shut-down when I disconnect. For this I've put a script in the if-up.d/ and if-down.d/ folders.

Script if-up.d/notifier:

Code:
#!/bin/sh

if [ "$METHOD" = loopback ]; then
	exit 0
fi

if [ "`iwgetid -as`" == "xx:xx:xx:xx:xx:xx" ]; then
	python2.5 /full/path/to/N900Notifierc.py
fi
with the xx:xx:xx:xx:xx:xx being my home wlan mac adress.

When I start the connection the script tells:

Code:
Traceback (most recent call last):
  File "N900Notifierc.py", line 81, in <module>
    objN900Notifierc = N900Notifierc("192.168.1.5", 50007)
  File "N900Notifierc.py", line 19, in __init__
    osso_ctx = osso.Context("test_abook", "0.1")		
  File "context.pyx", line 8, in osso.context.Context.__cinit__ (osso/context.c:531)
osso.exceptions.OssoException: Cannot initialize context.
I think the issue is that N900Notifierc.py shouldn't be started by root (as it is with if-up), but by the user, as when I start it by the user everything works as expected. The other scripts I have in if-up.d/ folder work with no problem so it is not a if-up issue.

Now the question: How can I execute the script in if-up.d/ folder with user rights?