Thread: NetConnect
View Single Post
Old 03-26-2012, 08: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: 2,986
Karma: 18343081
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
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