LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 10-12-2005, 08:40 AM   #1
promethious
LQ Newbie
 
Registered: Sep 2005
Posts: 20

Rep: Reputation: 0
Start RealVNC at boot using init.d


I have searched hundreds of forums and tried several things however I keep winding up with a problem in one way or another. (Note- I am using RealVNC, not the vnc that comes with Fedora)

I am just trying to start my vnc server when the computer boots. I have created a file called vnc in my /etc/init.d
Code:
#! /bin/sh
export USER="root"
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11"
NAME=vnc
start()
{
    su - $USER -c"vncserver :3"
}
stop()
{
    su - $USER -c"vncserver -clean -kill :3"
}
case "$1" in
    start)
        echo -n "Starting Xvnc: "
        start
        ;;
    stop)
        echo -n "Stopping Xvnc "
        stop
        ;;
    restart)
    restart)
        echo -n "Restarting Xvnc "
        stop
        start
        ;;
    *)
        echo "Usage: /etc/init.d/$NAME {start|stop|restart}"
        exit 1
        ;;
esac
exit 0
Then I ran the folowing
Code:
ln -s /etc/init.d/boot.vnc /etc/rc0.d/K99vnc
ln -s /etc/init.d/boot.vnc /etc/rc1.d/S99vnc
ln -s /etc/init.d/boot.vnc /etc/rc2.d/S99vnc
ln -s /etc/init.d/boot.vnc /etc/rc3.d/S99vnc
ln -s /etc/init.d/boot.vnc /etc/rc4.d/S99vnc
ln -s /etc/init.d/boot.vnc /etc/rc5.d/S99vnc
ln -s /etc/init.d/boot.vnc /etc/rc6.d/K99vnc
And when I restart my comptuer it says 'Starting VNC' and i get a green 'OK' and a few seconds later I get
Code:
su: /bin/bash Permission Denied
I get the same results when I change USER="root" to my username.

If I run
Code:
[root@intrepid init.d]# bash vnc start
Starting Xvnc:
New 'intrepid.federation:3 (root)' desktop is intrepid.federation:3

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/intrepid.federation:3.log

[root@intrepid init.d]#
The VNC server starts fine. This would lead me to believe the code is correct. Why do I get Permission Denied at boot?
 
Old 10-12-2005, 11:30 AM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,333

Rep: Reputation: 143Reputation: 143
The X server has to be up and running before you can start the VNC server. When init.d scripts run, X is not up. I think that's your problem; you're trying to start VNC too early. This would also explain why your script works when you run it after booting up; X is up and running at that time.
I'm not that familiar with fedora, but I think you need to add your script someplace like /etc/X11/xinit.d. I'm also not that familiar with gnome, but it may have a way of autostarting scripts/programs when it first comes up. In fact, I'm fairly certain that gnome has some way to do that. That would be where I would look.
 
Old 10-12-2005, 05:07 PM   #3
LinuxDave
LQ Newbie
 
Registered: Dec 2004
Posts: 21

Rep: Reputation: 15
Quote:
The X server has to be up and running before you can start the VNC server
This most certainly is not true. VNC runs its own X server.

Fedora/Redhat already have vnc startup scripts in /etc/init.d Why can't you use that script but change it to use your version of VNC?

LinuxDave
 
Old 10-14-2005, 08:58 AM   #4
promethious
LQ Newbie
 
Registered: Sep 2005
Posts: 20

Original Poster
Rep: Reputation: 0

Well, I was trying to learn something about linux by installing and configuring a program my self instead of just letting it install its self and add all the scripts for me. But I have been searching for over 2 weeks now and no one can tell me how to start the downloaded rpm version of RealVNC using rc.local or inid.d so I have uninstalled it and installed the vnc that comes with Fedora.
Code:
rpm -e vnc
I then modifed /etc/sysconfig/vncservers by uncommenting the lines.

Code:
VNCSERVERS="3:username"
VNCSERVERARGS[3]="-geometry 800x600"
Rebooted and it works fine.

Here is a good site that explains how to do this on Fedora.
http://www.redhat.com/magazine/006apr05/features/vnc/

If anyone knows how to do what I was trying to do please respond. I would still like to learn how to do things manualy.

Thanks
 
  


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
INIT failing to start dubya Fedora 3 04-25-2005 07:59 PM
To start init 2 at boot satimis Fedora 3 10-05-2004 05:02 AM
Boot into / start in INIT 3 svarreby Fedora 3 02-16-2004 10:11 AM
start services at init.d mikeshn Linux - General 1 12-24-2002 06:43 PM
INIT problem, won't start x bulliver Linux - General 7 11-07-2002 12:42 AM


All times are GMT -5. The time now is 07:06 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration