Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
(fix): change daemon name and init script (#10031)
Browse files Browse the repository at this point in the history
* (fix): change daemon name and init script

* (enh): manage mysql 8 + mariadb 10.5

* Update cron/centreon-backup-mysql.sh

Co-authored-by: Kevin Duret <kduret@centreon.com>
  • Loading branch information
pkriko and kduret committed Sep 7, 2021
1 parent e423e72 commit ba674f0
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions cron/centreon-backup-mysql.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,20 @@ SNAPSHOT_MOUNT="/mnt/snap-backup"
SAVE_LAST_DIR="/var/lib/centreon-backup"
SAVE_LAST_FILE="backup.last"
DO_ARCHIVE=1
INIT_SCRIPT="" # will try to find it later
PARTITION_NAME="centreon_storage/data_bin centreon_storage/logs"
MNT_OPTIONS_XFS="-o nouuid"
MNT_OPTIONS_NOT_XFS=""

###
# Check MySQL launch
###
process=$(ps -o args --no-headers -C mysqld)
if ps -o args --no-headers -C mariadbd >/dev/null ; then
process="mariadb"
elif ps -o args --no-header -C mysqld >/dev/null ; then
process="mysqld"
else
output_log "ERROR: Can't find MySQL process running." 1
fi
started=0

#####
Expand Down Expand Up @@ -98,17 +103,6 @@ fi
datadir=$(cd "$datadir"; pwd -P)
output_log "MySQL datadir finded: $datadir"

# Get init script
if [ -e "/etc/init.d/mysql" ] ; then
INIT_SCRIPT="/etc/init.d/mysql"
elif [ -e "/etc/init.d/mysqld" ] ; then
INIT_SCRIPT="/etc/init.d/mysqld"
fi
if [ -z "$INIT_SCRIPT" ] ; then
output_log "ERROR: Can't find init MySQL script." 1
exit 1
fi

###
# Get mount
###
Expand Down Expand Up @@ -205,7 +199,7 @@ echo "#####################"
if [ "$started" -eq 1 ] ; then
i=0
output_log "Stopping mysqld:" 0 1
$INIT_SCRIPT stop
systemctl stop $process
while ps -o args --no-headers -C mysqld >/dev/null; do
if [ "$i" -gt "$STOP_TIMEOUT" ] ; then
output_log ""
Expand All @@ -231,7 +225,7 @@ lvcreate -l $free_pe -s -n dbbackup $lv_name
# Start server
###
output_log "Start mysqld:"
$INIT_SCRIPT start
systemctl start $process

###
# Mount snapshot
Expand Down

0 comments on commit ba674f0

Please sign in to comment.