LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   starting services using rc.local (https://www.linuxquestions.org/questions/linux-newbie-8/starting-services-using-rc-local-379264/)

supersucker 11-02-2005 09:14 AM

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..........

tredegar 11-02-2005 09:48 AM

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

supersucker 11-02-2005 10:41 AM

thanks for the answer!

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

but what about the mysql-server?

any ideas?

tredegar 11-02-2005 10:57 AM

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?)

supersucker 11-03-2005 03:58 AM

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?

bathory 11-03-2005 05:43 AM

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.

supersucker 11-03-2005 10:10 AM

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.........

ethics 11-03-2005 10:43 AM

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.

farslayer 11-03-2005 11:05 AM

misread the question.. never mind..


All times are GMT -5. The time now is 09:13 PM.