maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   persistent x11vnc server (https://talk.maemo.org/showthread.php?t=48878)

cddiede 2010-03-31 19:45

persistent x11vnc server
 
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.

WorldKaoss 2010-07-27 22:13

Re: persistent x11vnc server
 
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!

sake 2010-07-27 22:25

Re: persistent x11vnc server
 
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.

WorldKaoss 2010-07-27 23:09

Re: persistent x11vnc server
 
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?

ishtangli 2010-08-01 14:40

Re: persistent x11vnc server
 
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.

WorldKaoss 2010-08-01 22:29

Re: persistent x11vnc server
 
it's still the same for me :(

soeiro 2010-08-27 13:44

Re: persistent x11vnc server
 
How do you get information about the current connection?

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


All times are GMT. The time now is 06:13.

vBulletin® Version 3.8.8