• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Adding mysql to chrooted permantely

Fabhino22Elz

Basic Pleskian
Hi,

i follwoed this article here and added the mysql to my chrooted template. That works, until the server is restarted.

Is there a way to add the mysql permanentyl to the chrooted template?

greetings and thx for your anwers.

tom
 
The link to the article is missing, is it this one: How to chroot MySQL client for users?

My guess is that the mount isn't being performed after a reboot. There are several ways how to set this up, e.g. one is to use crontab.

You might want to look at the current crontab first:
Code:
crontab -l

and back it up:
Code:
crontab -l > /root/crontab-backup.txt

then edit it:
Code:
crontab -e

and enter in a new line at the end (press G and o to move to the end and start editing on a new line; press ESC then :x to save and quit):
Code:
@reboot /usr/bin/sh /path/to/the/mountscript.sh

(if you've made a mistake, press ESC and :q! to quit without saving, start over)

Create a mount script first and test it by running it manually, only add it to crontab once you're satisfied with it.
 
First - Thanks to your answer! :)

Yes, that is the right article.

Before i start my test 2 more questions:
  1. I only need a shell script that runs the mount after every reboot, is that right?
  2. In the article i have to run that mount order and that stuff for every domain. is there a way to apply that directly to all domains?
Greetings
 
You're welcome!
I only need a shell script that runs the mount after every reboot, is that right?
Yes, but do test to double check.
In the article i have to run that mount order and that stuff for every domain. is there a way to apply that directly to all domains?
The procedure could be automated fully, including the initial setup when the domain is created. I'd consider the number of domains or, better said, how often would this need to be done manually, before deciding on how far to take it.

For full automation, I'd look into using Plesk Event Handlers and go from there, including using a bit less hackish and a more complex mount script than I'm about to suggest.

But if you'd like to keep it simple (hackish but KISS, which isn't necessarily bad) and limit the automation to reboots only, I suggest using shell scripting to generate a list of domains and iterate over the list with a for loop to perform a bind mount for each domain. The script could be triggered by the crontab, as mentioned in the previous post.

Like I mentioned, it all depends on how far you'd like to take this...
 
Back
Top