Thread: NetConnect
View Single Post
Old 03-26-2012, 09:52 PM   #2
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 1,768
Karma: 4368476
Join Date: Oct 2010
Location: Vancouver, BC, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623
I'm not sure about the problems with NetConnect, but you could kludge a solution by calling your program from a shell script, and wrapping it in calls to netagent connect/disconnect. Here's how I do it in my sshd start and stop scripts:

Code:
# Connect to the net first if necessary.
ifconfig eth0 1> /dev/null 2> /dev/null
if [ $? -ne 0 ]; then
  touch /tmp/sshd-connected-to-wifi
  /ebrmain/bin/netagent connect
fi

... do stuff here

if [ -f /tmp/sshd-connected-to-wifi ]; then
  rm -f /tmp/sshd-connected-to-wifi
  /ebrmain/bin/netagent disconnect
fi
The code connects to the net if required, and disconnects later if it had been originally disconnected.
rkomar is offline   Reply With Quote