LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 12-03-2012, 08:13 AM   #1
hamidi2
Member
 
Registered: Aug 2012
Posts: 61

Rep: Reputation: Disabled
910913 - who runs mysql at startup?


i've a shell in rc2.d to be run at startup of ubuntu 10.10. but this shell script needs to connect to mysql. so it must be run after mysql gets stable and ready to respond.
i could not find how mysql gets started. i didn't find the corresponding shell in rcx.d. i don't know how to figure out that mysql gets ready. i don't know who (what process) runs mysql and how it's run at startup.
 
Old 12-03-2012, 08:30 AM   #2
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
Ok, now your second thread about this subject, look here: https://help.ubuntu.com/community/UbuntuBootupHowto

For the others who want to help: http://www.linuxquestions.org/questi...wn-4175439689/ here's how it all began.

Markus
 
Old 12-03-2012, 11:45 PM   #3
hamidi2
Member
 
Registered: Aug 2012
Posts: 61

Original Poster
Rep: Reputation: Disabled
thank u for the link. a very good description is documented. i investigated in the directories and files. i found this in /etc/init.d/rc:
Code:
...
if [ S = "$runlevel" ]
then
	startup boot
else
	startup $ACTION
fi
...
i think if Config.pm would be a shell script, i could put the same if statement and decide whether the system is starting up, right?
if so, the question gets: how can i check $runlevel from inside of perl?
 
Old 12-04-2012, 12:13 AM   #4
hamidi2
Member
 
Registered: Aug 2012
Posts: 61

Original Poster
Rep: Reputation: Disabled
like what in Windows when bringing up services at startup, is there a way to make my own service dependent to mysql?
i think the problem will be resolved this way.
 
Old 12-04-2012, 12:43 AM   #5
hamidi2
Member
 
Registered: Aug 2012
Posts: 61

Original Poster
Rep: Reputation: Disabled
i think these files in /etc/init.d may be used for this purpose:
.depend.boot
.depend.start
.depend.stop
.legacy-bootordering
but i don't know their format.
 
Old 12-04-2012, 02:00 AM   #6
hamidi2
Member
 
Registered: Aug 2012
Posts: 61

Original Poster
Rep: Reputation: Disabled
this is written in the document:
Code:
sudo update-rc.d myscript defaults 98 02
how can i know how is this command run when the package is installed?
in another hand, the package is named K20... and S20... in rcx.d's directories. what does it mean? i expect them to be S20 and K80 as described in the document.
 
Old 12-04-2012, 02:20 AM   #7
hamidi2
Member
 
Registered: Aug 2012
Posts: 61

Original Poster
Rep: Reputation: Disabled
but still this doesn't work.
the only way is to force system wait for mysql to get ready for response THEN runs myscript when boot &
run myscript before mysql begins shutting down when halt.
how is this possible?
 
Old 12-04-2012, 07:17 AM   #8
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850Reputation: 850
hamidi2, you answer your own questions in every posting. Why don't you try it out or read more about the boot process with Ubuntu. Starting services in Windows is indeed very similar to your issue. You'll only have to find out where mysql is started in the Ubuntu scripts then add your own script, just try it out, maybe write a simple script which prints hello to the screen or touches a file so that you can check if and when this file was created.

I don't have enough knowledge about Ubuntu and can't help here. Or should I say "install Slackware, then I can help you"
As for Slackware, that's how mysql is started in Slackware (in rc.M)
Code:
# Start the MySQL database:
if [ -x /etc/rc.d/rc.mysqld ]; then
  . /etc/rc.d/rc.mysqld start
fi
Markus
 
  


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
e2fsck auto runs on / upon startup after so many mounts acummings Slackware 8 04-04-2012 06:30 PM
Create new script that runs on startup pnellesen SUSE / openSUSE 1 01-23-2007 08:29 PM
Script that runs on startup spank Ubuntu 3 07-04-2006 11:56 AM
what shell script runs only at bootup/startup pwhitey86 Mandriva 2 12-22-2004 10:13 PM
how do I make httpd a process that runs on startup Belkorin Linux - Software 4 07-09-2004 02:32 PM


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