Networking :: Startup Script for VNC-server



Hello, I am fairly new to Linux (have had Ubuntu on my laptop for like 6 months), but yesterday I decided to blow the dust off of a old 500MHz computer with 32MB memory.  I have installed DSL and the VNC-server-addon and I have this working with a password in X, but I would like for it to start up with password-verification upon bootup so that I do not have to keep the monitor/mouse/keyboard connected to get VNC up and running.  Therefore, I am kindly asking for how to create a script that will do this.  :)
As I said before (not blaiming you to start new topic):
Quote
In some cases must create a password file by:
Code Sample
vncpasswd <password_file>

Type a password of your choice.

Then for example if you want to run your vnc server grab your current display but have it to ask the password you chosed
Code Sample
x0vncserver -PasswordFile=<password_file>


I hope this helps...


I don't clearly remember how to start VNC server to other display... But adding line
Code Sample
x0vncserver -PasswordFile=<password_file> &
to your .bash_profile will then start automatically your VNC server for display 0.

I'll post later some more. I'm at work right now and my break is almost over.  :p

Thank you for your quick reply, but I had already figured out how to get the password to work from your post about that. :)

I have figured out how to create a script now, that's a start.  I created the file startvnc in /etc/init.d/ and made it writable.  Then I started writing in the code:

##This script will start up the vnc-server upon bootup
/usr/local/bin/vnc4x.sh
xvncserver -PasswordFile=tjajaja
/usr/local/bin/vnc4x0.sh
x0vncserver -PasswordFile=tjajaja
x0vncserver -PasswordFile=tjajaja

As this is my first script, I am curious to know if this will work, I do not want to restart the box if this will not work without editing other files in /etc/init.d/ or the code is downright wrong  :laugh:

I'm not sure but I think your script hangs to the second line.
xvncserver will wait there until it has copleted its tasks. Propably as long as you want it to be running...

Basic bash scriptting is quite easy:
Code Sample
xvncserver
anotherprogram
Now. If I was right this script also hangs. This will hang to the first line.
Here's a way to make it run in the background:
Code Sample
xvncserver &
anotherprogram
Adding & will tell script to advance to next task and let preivious task to run 'freely'. You could always do it like this:
Code Sample
xvncserver & anotherprogram


Here's some beginner guidance to bash scripting. And
here's bit information related to this backgound thing...

I hope this helped and didn't confuse you.

HERE's a link to the wiki on an old post about setting up VNC at boot.

Chris

Next Page...
original here.