MariaDB - how to populate database at startup

Latest response

Hi all,

I have a question - how would one go at it to populate a MariaDB database with a number of tables each time a pod gets deployed (I'm running this on OpenShift)?

The idea is that I have a script that checks if a certain table already exists and, if not, it should create a number of tables.

What would be the best approach to getting that bash script executed so I'm sure that, whenever a pod is started, I have the tables needed for the application to run correctly?

A big thank you in advance for any ideas / suggestions!

Bernard.

Responses

You could add a command to execute that script in /etc/rc.d/rc.local file which gets executed at the end in runlevels 3/5.

Hi - thank for your the input - however, it seems I forgot to mention 1 crucial piece of info in my post (which I now added) -> I'm running this on OpenShift... Which means I don't have access to the rc.local (if I'm not mistaking)...

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.