LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-07-2011, 05:40 PM   #1
explorer
Member
 
Registered: Feb 2003
Posts: 229

Rep: Reputation: 34
starting vncserver from rc.local


I'm a little new to Slackware so maybe this isn't the right way to initiate vncserver on boot, but here's what I've got. The last two lines in my rc.local are:

/usr/bin/vncserver :1 &
mount.cifs //192.168.1.99/shared /mnt/shared -o username='uname',password='passwd'

the second line runs successfully on boot, but the first line doesn't. However, after I am logged on, I can execute /etc/rc.d/rc.local and both lines will run successfully. Does the system need to be fully logged on to start the vncserver, or should I start it elsewhere other than rc.local ? Thanks in advance.

Mike
-----------------------------
Using Slackware 13.1 (32 bit) and the Vnc package that came with the Slackware image, not sure of the version.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-07-2011, 06:32 PM   #2
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,949

Rep: Reputation: 1531Reputation: 1531Reputation: 1531Reputation: 1531Reputation: 1531Reputation: 1531Reputation: 1531Reputation: 1531Reputation: 1531Reputation: 1531Reputation: 1531
You should be starting /etc/rc.vncservers from rc.local. There is also a /etc/rd.d/rc.vncservers.conf that may require editing.

Code:
if [ -x /etc/rc.d/rc.vncservers ]; then
   /etc/rc.d/rc.vncservers start
fi

Last edited by chrisretusn; 03-07-2011 at 06:34 PM.
 
2 members found this post helpful.
Old 03-07-2011, 07:11 PM   #3
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
I used to use the following as a start-up script for VNC. It was called from /etc/rc.d/rc.local (and therefore run by root):
Code:
#!/bin/sh
#
# description: Starts and stops vncserver. \
#         used to provide remote X administration services.

unset VNCSERVERARGS
VNCSERVERS="1:steve 2:james"
VNCSERVERARGS[1]="-geometry 1600x1200"
VNCSERVERARGS[2]="-geometry 1024x768"

start() {
  echo -n $"Starting VNC server: "

  if [ ! -d /tmp/.X11-unix ]
  then
    mkdir -m 1777 /tmp/.X11-unix || :
  fi
  for display in ${VNCSERVERS}
  do
    echo -n "${display} "
    unset BASH_ENV ENV
    DISP="${display%%:*}"
    export USER="${display##*:}"
    export VNCUSERARGS="${VNCSERVERARGS[${DISP}]}"
    su - ${USER} -c "cd ~${USER} && [ -f .vnc/passwd ] && vncserver :${DISP} ${VNCUSERARGS} -localhost"
  done
}

stop() {
  echo -n $"Shutting down VNC server: "
  for display in ${VNCSERVERS}
  do
    echo -n "${display} "
    unset BASH_ENV ENV
    export USER="${display##*:}"
    su ${USER} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1
  done
  echo "Done."
}

# See how we were called.
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart|reload)
    stop
    sleep 3
    start
    ;;
  *)
    echo $"Usage: $0 {start|stop|restart}"
esac
 
2 members found this post helpful.
Old 03-07-2011, 07:27 PM   #4
explorer
Member
 
Registered: Feb 2003
Posts: 229

Original Poster
Rep: Reputation: 34
Thanks fellas. Was that code your rc.venserver gilead ? I don't think I have a rc.vncserver so I probably need to make one.
 
Old 03-07-2011, 09:04 PM   #5
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Yep, that's right - it was in /etc/rc.d/rc.vncserver (call it whatever you like though)
 
1 members found this post helpful.
Old 03-08-2011, 10:50 AM   #6
explorer
Member
 
Registered: Feb 2003
Posts: 229

Original Poster
Rep: Reputation: 34
got it fixed ! Thanks again fellas, I appreciate it. I think I'm gonna like being a slacker !
 
Old 03-08-2011, 02:06 PM   #7
explorer
Member
 
Registered: Feb 2003
Posts: 229

Original Poster
Rep: Reputation: 34
one more thing.....

When I want to end the session from the vnc-viewer machine, I click the vnc icon at the very top-left of the vnc-viewer window, the one at the left end of the title bar, and click the Close option from the menu that pops up. Then I can start a new session again later if I want. If I try to log off using the logoff menu-item on the remote screen like a local user would do, the viewer window goes black but doesn't close and the session is left open. Then you have to manually close the window anyway, and after you close it, you can't start a new session until a "rc.vncservers restart" has been done or a new server session started. I only post this in case anyone else might be wondering how to end a viewer session.
 
Old 03-08-2011, 04:43 PM   #8
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
That's good to know - thanks for posting it. If you find VNC slow over the network, there's also rdesktop (Linux and Windows) or NX type solutions (nomachine, freenx for Linux environments).
 
1 members found this post helpful.
Old 03-08-2011, 04:53 PM   #9
Gerard Lally
Senior Member
 
Registered: Sep 2009
Location: Leinster, IE
Distribution: Slackware, NetBSD
Posts: 2,176

Rep: Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761Reputation: 1761
Quote:
Originally Posted by gilead View Post
That's good to know - thanks for posting it. If you find VNC slow over the network, there's also rdesktop (Linux and Windows) or NX type solutions (nomachine, freenx for Linux environments).
Another one worth keeping in mind is xrdp, which proxies VNC on the server through the RDP protocol, also on the server. It makes for a very smooth remote desktop session. Easy to install and run, and then just connect to port 3389 on the server using an RDP client - mstsc on Windows, rdesktop on Linux/BSD.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Starting vncserver at boot using rc.local promethious Linux - General 3 10-14-2005 07:57 AM
Starting vncserver mickeyboa Fedora 3 08-08-2005 02:47 AM
vncserver in rc.local as other user? jvdbossc Linux - General 2 05-24-2004 08:45 AM
vncserver won't start from rc.local GD_19 Linux - Software 5 03-13-2004 12:27 AM
Problem starting vncserver bunghole Linux - Networking 2 10-29-2001 03:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration