LinuxQuestions.org
Review your favorite Linux distribution.
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 11-02-2005, 10:14 AM   #1
supersucker
Member
 
Registered: Jul 2004
Location: Berlin
Distribution: fedora 3
Posts: 79

Rep: Reputation: 15
starting services using rc.local


hi everybody,

i dont understand the following:

i wanted to start some services after a user logged in using the rc.local file (Fedora Core 4), some of the entries i put into the rc.local do work others not.

starting the apache for example works:

entry in rc.local:

/usr/local/apache2/bin/apachectl start

works fine, wether i put the line in the rc.local or paste it in the shell

but:

/usr/bin/x11vnc -shared -forever

doesnt work when i put it in the rc.local and restart the computer, i.e. the server doesnt start....
the thing i dont understand is if i paste the line into the shell, the server starts without errors.....

same with:

su mysql -c "/etc/rc.d/init.d/mysql start"

doesnt start the server after i rebooted, but if i paste the line into the shell after loggin in, the server starts without errors.....

how can that be?
how can an entry in the rc.local not work in the rc.local itself, but if i paste it into the shell it works? and why then works the apache-entry in the rc.local?

i am absolutely clueless, thx for any help..........
 
Old 11-02-2005, 10:48 AM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Someone clever than me will be able to help you better, but basically the problem is that x11vnc needs X to be running, and when you call it from rc.local, X is not yet running. You may find a message to this effect in /var/log/messages.

When you call x11vnc from an Xterm, then X is running and it will work.

Of course apache does not need X, so you have no trouble starting that from rc.local.

So, you need to put your call to start x11vnc somewhere else - but I do not know where (as I think you want x11vnc running before you have even logged in) so you could man startx and man xinit or hope someone else reads this!

HTH
 
Old 11-02-2005, 11:41 AM   #3
supersucker
Member
 
Registered: Jul 2004
Location: Berlin
Distribution: fedora 3
Posts: 79

Original Poster
Rep: Reputation: 15
thanks for the answer!

i didnt think of that, quite stupid of me........

but what about the mysql-server?

any ideas?
 
Old 11-02-2005, 11:57 AM   #4
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Quote:
but what about the mysql-server?
I do not run mysql, so I am not sure.

You should know that you do not need the su bit if yuo are putting the command in rc.local as this already runs as root. Did you look in /var/log/messages for errors when you tried starting mysql-server from rc.local? Does mysql-server need environment variables setting up (PATH etc?)
 
Old 11-03-2005, 04:58 AM   #5
supersucker
Member
 
Registered: Jul 2004
Location: Berlin
Distribution: fedora 3
Posts: 79

Original Poster
Rep: Reputation: 15
Quote:

Did you look in /var/log/messages for errors when you tried starting mysql-server from rc.local?

yes, nothing significant in there........

the funny thing is, if i have that mysql-line in the rc.local the computer wont even boot the OS in runlevel 5, it hangs after echoing "checking swapspace".......
i had to boot into single user mode and to comment the mysql-entry in the rc.local out to get the computer booting in runlevel 5 again.......

Quote:

Does mysql-server need environment variables setting up (PATH etc?)

As far as i know not........

any more ideas?
 
Old 11-03-2005, 06:43 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,520

Rep: Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501
Quote:
su mysql -c "/etc/rc.d/init.d/mysql start"
I don't think that mysql-server must be run under mysql user. It starts as root and once up uses the mysql user (same as apache and other daemons do). So remove the "su mysql -c" part and try again.
 
Old 11-03-2005, 11:10 AM   #7
supersucker
Member
 
Registered: Jul 2004
Location: Berlin
Distribution: fedora 3
Posts: 79

Original Poster
Rep: Reputation: 15
quote:

I don't think that mysql-server must be run under mysql user. It starts as root and once up uses the mysql user (same as apache and other daemons do). So remove the "su mysql -c" part and try again.

but if i try to start the server as root i get an error message that this isnt possible........
anyway,

sudo -u mysql /usr/sbin/mysqld --skip-grant

did the job, but only at the bash, if i paste it into the rc.local and reboot the computer hangs again and wont boot into runlevel 5......:-(

any ideas?

i got another problem with the vnc-server:

scince it didnt work in the rc.local file, i made a

ln -s /usr/bin/x11vnc -shared -forever

in the directory ~/.kde/Autostart

but this doesnt work, the command "file" says it is a broken link

ln -s /usr/bin/x11vnc

does work, so the problem is with the arguments "-shared" and "-forever" passed to x11vnc. but a

ln -s "/usr/bin/x11vnc -shared -forever"

doesnt work as well!

how do i have to pass the arguments to x11vnc? do i have to quote them in a special way?

thx for all the help so far.........
 
Old 11-03-2005, 11:43 AM   #8
ethics
Senior Member
 
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
Quote:
Originally posted by supersucker
[B]quote:

I don't think that mysql-server must be run under mysql user. It starts as root and once up uses the mysql user (same as apache and other daemons do). So remove the "su mysql -c" part and try again.

but if i try to start the server as root i get an error message that this isnt possible........
anyway,

sudo -u mysql /usr/sbin/mysqld --skip-grant

did the job, but only at the bash, if i paste it into the rc.local and reboot the computer hangs again and wont boot into runlevel 5......:-(

any ideas?
add an & at the end?? just a guess, but this will run the program in the background, allowing the system to continue booting, otherwise your boot sequence is going to be waiting for SQL server to end before it can continue.
 
Old 11-03-2005, 12:05 PM   #9
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
misread the question.. never mind..
 
  


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
FreeBSD starting services reddazz *BSD 4 04-17-2005 11:14 AM
Something Comaparable Screen to SERVICES(local) in RH 9 bpellet314 Linux - Newbie 1 02-15-2005 04:39 PM
Starting services from terminal ExploiT Linux - General 4 09-18-2004 11:04 PM
Starting Services InEeDhElPlInUx Linux - Newbie 9 11-06-2003 12:57 PM
Cannot access any services outside local network webnoelle Linux - Software 19 07-24-2003 08:55 PM


All times are GMT -5. The time now is 08:55 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration