Start mysql before another application

Through YaST’s System Services I configured an application to start on boot. However, the application (mediatomb) is using mysql, so it should not be started before mysql. It is however, which means mediatomb fails to start.

How can I make sure mysql is started before mediatomb?

You should have a file /etc/rc.d/mediatomb with a section (at the top) starting with ### BEGIN INIT INFO and ending with ### END INIT INFO. In this file, add ‘mysql’ at the end of the ‘Should-Start’ and ‘Should-Stop’ lines. Look at the files /etc/rc.d/apache2 and /etc/rc.d/postfix if you have them. They start mysql as well.

On Sun, 06 Mar 2011 01:06:01 +0530, Creap
<Creap@no-mx.forums.opensuse.org> wrote:

>
> Through YaST’s System Services I configured an application to start on
> boot. However, the application (mediatomb) is using mysql, so it should
> not be started before mysql. It is however, which means mediatomb fails
> to start.
>
> How can I make sure mysql is started before mediatomb?
>
>

do you need mediatomb in runlevel 3? if not, have it start in RL 5 only;
mysql by default starts at RL 3.


phani.

On 2011-03-05 20:36, Creap wrote:

> How can I make sure mysql is started before mediatomb?

It is the other way round, start mediatomb later.

I guess that you are starting your app from the /etc/init.d/boot.local
script; you should use the /etc/init.d/after.local script instead.

Another method is to create your own startup script; you have a sample in
“/etc/init.d/skeleton”, and documentation in the SuSE book.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

You might want to setup you machine to not boot in parallel.
This will slow down your boot time but may save you some headaches if you really need service X to start before service Y.
To do this change the “RUN_PARALLEL” option to “no” in /etc/sysconfig/boot

Good luck,
Hiatt

On 2011-03-06 14:36, jthiatt08 wrote:
>
> You might want to setup you machine to not boot in parallel.
> This will slow down your boot time but may save you some headaches if
> you really need service X to start before service Y.

You do not need to set parallel to no to ensure a particular script runs
before or after another one. Sure, things get complicated, but they must work.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

Try running the FAM daemon and the CUPS daemon together.
The FAM daemon can bind to any port between 600-1024 (yes, I know that’s ridiculous) and the CUPS daemon binds to port 631.
I had CUPS set to start before FAM but every once in a while FAM would still bind to port 631 causing CUPS to fail.
Stopping the init scripts from starting in parallel resolved this issue. I know it’s an obscure issue but I hope explains my previous suggestion.

Thanks,
Hiatt

That’s the wrong fix. You should get FAM to avoid port 631 and in fact any ports that are reserved for other services. I had a similar issue with portmapper (I think) once. And it was random. Fortunately portmapper has an option to specify the port.

The version of I had FAM didn’t have a way to specify the port. I eventually stopped using FAM, which turned out to be a better fix.:slight_smile:

On 2011-03-07 01:06, jthiatt08 wrote:
> Try running the FAM daemon and the CUPS daemon together.

I do. I’ve never seen an issue such as you describe. I assume you created a
Bugzilla about it, no?


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

No, sorry, I did not create a Bugzilla about it. It was on SLES 10 and it didn’t happen all the time.
It was considered more of an annoyance than a bug and my coworkers and I worked around it.

We are now starting to use openSuse 11.3 and are able get rid of the need for FAM altogether.

I can send you the logs from the servers on which the FAM problem occurred if you are interested.

Hiatt

On 2011-03-07 03:36, jthiatt08 wrote:

> I can send you the logs from the servers on which the FAM problem
> occurred if you are interested.

No, I’m not that interested, but I’m sure the SUSE devs would be, very much
so. :slight_smile:

It is the only way of getting rid of those problems for the future. We work
around issues ourselves, but they have to be really solved be them.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

There was no line called Should-Start, but I took a look at the postfix script, and now I have this in /etc/rc.d/mediatomb:

### BEGIN INIT INFO
# Provides:     mediatomb
# Required-Start:   $local_fs $remote_fs $network
# Should-Start:     mysql
# Required-Stop:    $local_fs $remote_fs $network
# Should-Stop:      mysql
# Default-Start:    3 5                                                                                            
# Default-Stop:     0 1 2 6                                                                                        
# Short-Description:    MediaTomb daemon
# Description:      This script starts and stops the mediatomb daemon
### END INIT INFO

I made mediatomb only start in RL 5 in System Services (mysql has 2,3,5 checked).

After trying both of these separately I still have this in /var/log/mediatomb:

 ERROR: The connection to the MySQL database has failed: mysql_error (2002): "Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)"

Running /etc/init.d/mediatomb start manually after booting works fine.

On 2011-03-12 12:06, Creap wrote:

>
> Code:
> --------------------
> ERROR: The connection to the MySQL database has failed: mysql_error (2002): “Can’t connect to local MySQL server through socket ‘/var/run/mysql/mysql.sock’ (2)”
> --------------------

IMO, mysql should be in Required-Start. Install with chkconfig. Verify by
checking the numbers.


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)