Notices


Reply
Thread Tools
cddiede's Avatar
Posts: 1,034 | Thanked: 784 times | Joined on Dec 2007 @ Annapolis, MD
#1
Okay, so my biggest problem with x11vnc on the N900 is it's tendency to crash or exit when you go offline or change network connections. Not a bug with the application per say, it's just not really optimized for usage on a mobile device that's hopping networks all day.

So I think I've got a solution:

I've placed the following script (called vncs) in:

/etc/network/if-up.d

What this does is first off, starts a vnc server on the N900 whenever a network connection is established.

Secondly, it will kill any vnc server that is already running so you don't end up with a boatload of vnc server processes running if you connect to several networks throughout the day.

script follows:

APPCHK=$(ps aux | grep -c x11vnc)

if [ $APPCHK = '0' ];

then

/usr/bin/nohup /usr/bin/x11vnc -forever &

else

/usr/bin/pkill x11vnc;/usr/bin/nohup /usr/bin/x11vnc -forever &

fi


I guess to have a truly persistent server you should change the "else" statement to do nothing. This should leave any running VNC server up and not start a new one when you start a new network connection.

I prefer the above so that the VNC that's running is kicked off by the latest network connection, be that gprs or Wi-Fi, and not by a network connection that was established previously, but each to his own.
 

The Following User Says Thank You to cddiede For This Useful Post:
Posts: 45 | Thanked: 3 times | Joined on Jun 2010
#2
Hey. I'm interested in this piece of script, but what extension should it have? .py ?

Also, what libraries are needed to run this?

Could you post a noob guide here? Thanks!
 
Posts: 42 | Thanked: 13 times | Joined on Jun 2010 @ Netherlands
#3
get root and then:

first, install the program:

apt-get install x11vnc leafpad

second, make the script
leafpad /etc/network/if-up.d/vncs

and copy the script. no extension.
next:

add at the top of the script:

#!/bin/sh

this is needed so linux can see what sort of file it is (instead of a exstension)

hope this helps,

BTW: you don't need to worry about libraries, as the package manager (apt) does.
 
Posts: 45 | Thanked: 3 times | Joined on Jun 2010
#4
I installed leafpad and x11vnc, I created the vncs file in /etc/network/if-up.d/

I added the following code and saved it:
Code:
#!/bin/sh

APPCHK=$(ps aux | grep -c x11vnc)

if [ $APPCHK = '0' ];

then

/usr/bin/nohup /usr/bin/x11vnc -forever &

else

/usr/bin/pkill x11vnc;/usr/bin/nohup /usr/bin/x11vnc -forever &

fi
And when I reconnect to my wireless router and get another IP the vncserver isn't starting, when I try to connect from my laptop I get "Connection refused". I tried even restarting the device, disconnecting and reconnecting and I get the same.

Any help?
 
Posts: 12 | Thanked: 1 time | Joined on Jul 2010
#5
I got this working after a lot of testing.

change

if [ $APPCHK = '0' ];

to

if [ $APPCHK = '1' ];

You might also want to add a terminate app script on if-post-down.d

Hope it helps.
 
Posts: 45 | Thanked: 3 times | Joined on Jun 2010
#6
it's still the same for me
 
Posts: 292 | Thanked: 131 times | Joined on Dec 2009
#7
How do you get information about the current connection?

i would like to test for a name (for wireless).
 
Reply


 
Forum Jump


All times are GMT. The time now is 01:56.