Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to run 2 VNCServers from one of my computers. I want one to run the startup commands specified in xstartup, but I want another one to execute different commands. How can this be done? Thanks.

share|improve this question
    
It would be helpful to understand what you are trying to accomplish or what problem you are running into. My experience has been to simply run vnc from the commandline of the ssh session, and everything seems to work pretty well, even with multiple VNC connections to the box. –  pcapademic Jan 9 '10 at 8:07
    
I want to give 2 people access to 2 different VNC servers. Each person needs different startup programs. –  user21431 Jan 9 '10 at 21:30

1 Answer 1

You can't directly execute a different xstartup file, but since it's really just a shell script you can accomplish this by building script logic that can figure out whether it is the first or second VNC session.

For example:

#!/bin/sh

# switch on display number for special sessions
[ $DISPLAY == ":1" ] && exec startupOne
[ $DISPLAY == ":2" ] && exec startupTwo

# ... else use the normal vnc xstartup

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
share|improve this answer
    
I'm having some trouble getting this to work. I checked the value of $DISPLAY in my VNCServers, and it's actually ":1.0" and ":2.0" instead. I changed the script to this, but I'm still not seeing the scripts being executed, even if I put the full path to the individual scripts. –  user21431 Jan 10 '10 at 0:02
    
Are the scripts executable? DO you get any error messages in $HOME/.xsession-errors? Are the scripts found in the current PATH? Perhaps you'll have more success if you use full path spec such as "exec $HOME/.vnc/startupOne". –  Shannon Nelson Jan 12 '10 at 4:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.