View Single Post
Posts: 169 | Thanked: 56 times | Joined on Jan 2010 @ Italia
#34
I tried with these up/down scripts for automatic run/stop:

N900:/etc/network# cat if-pre-up.d/00_notifier_up
#!/bin/sh

MYIP=`ifconfig -a wlan0 | grep "inet addr" | sed 's/inet addr://g' | awk '{print $1}'`

if [ "$MYIP" == "192.168.0.5" ]
then su user -c /home/user/bin/notifier_client_home.py &
else su user -c /home/user/bin/notifier_client_work.py &
fi

N900:/etc/network# cat if-post-down.d/00_notifier_down
#!/bin/sh

PIDS=`ps | grep "notifier_client" | grep "/home/user/bin" | awk '{ORS=" ";print $1}'`
for i in $PIDS ; do kill -9 $i ; done

N900:/etc/network#



these work fine when executed in terminal but dont work automatically on network connection/disconnection

Last edited by cipper; 2010-10-31 at 20:19.