Added check for mariadb-admin, mariadb-dump and mariadb to scripts

git-svn-id: svn://192.168.202.10@4018 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2026-09-02 04:37:29 +00:00
parent 3b9508a5a8
commit d1a8cfe5e9
2 changed files with 37 additions and 19 deletions
+11 -2
View File
@@ -5,7 +5,7 @@
# DESCRIPTION: # DESCRIPTION:
# Backs-up the asterisk database, conf/agi/sounds/bin files # Backs-up the asterisk database, conf/agi/sounds/bin files
# #
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2026 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# #
# CHANGELOG # CHANGELOG
# #
@@ -28,6 +28,7 @@
# 191119-1658 - Added --db-remote option to specify '--host' parameter for mysqldumpdump # 191119-1658 - Added --db-remote option to specify '--host' parameter for mysqldumpdump
# 210817-1956 - Added --db-leads-only option to dump only the vicidial_list table # 210817-1956 - Added --db-leads-only option to dump only the vicidial_list table
# 230215-1456 - update of table categories # 230215-1456 - update of table categories
# 260901-1012 - Added check for mariadb-dump and mariadb first
# #
$secT = time(); $secT = time();
@@ -345,6 +346,9 @@ if ( ($without_db < 1) && ($conf_only < 1) )
### find mysqldump binary to do the database dump ### find mysqldump binary to do the database dump
print "\n----- Mysql dump -----\n\n"; print "\n----- Mysql dump -----\n\n";
$mysqldumpbin = ''; $mysqldumpbin = '';
if ( -e ('/usr/bin/mariadb-dump')) {$mysqldumpbin = '/usr/bin/mariadb-dump';}
else
{
if ( -e ('/usr/bin/mysqldump')) {$mysqldumpbin = '/usr/bin/mysqldump';} if ( -e ('/usr/bin/mysqldump')) {$mysqldumpbin = '/usr/bin/mysqldump';}
else else
{ {
@@ -358,7 +362,11 @@ if ( ($without_db < 1) && ($conf_only < 1) )
} }
} }
} }
}
$mysqlbin = ''; $mysqlbin = '';
if ( -e ('/usr/bin/mariadb')) {$mysqlbin = '/usr/bin/mariadb';}
else
{
if ( -e ('/usr/bin/mysql')) {$mysqlbin = '/usr/bin/mysql';} if ( -e ('/usr/bin/mysql')) {$mysqlbin = '/usr/bin/mysql';}
else else
{ {
@@ -372,6 +380,7 @@ if ( ($without_db < 1) && ($conf_only < 1) )
} }
} }
} }
}
use DBI; use DBI;
@@ -455,7 +464,7 @@ if ( ($without_db < 1) && ($conf_only < 1) )
{ {
$archive_tables .= " $aryA[0]"; $archive_tables .= " $aryA[0]";
} }
elsif ($aryA[0] =~ /_log|server_performance|vicidial_ivr|vicidial_hopper|vicidial_manager|web_client_sessions|imm_outcomes|_counts|_sip$|_recent|_queue$|_urls$/) elsif ($aryA[0] =~ /_log|server_performance|vicidial_ivr|vicidial_hopper|vicidial_manager|web_client_sessions|imm_outcomes|_counts|_sip$|_recent|_queue$|_urls$|_overrides|_messages|_drops|_auth|_calls|_caller_codes|_daily|_extensions|_gaps|_reserve/)
{ {
$log_tables .= " $aryA[0]"; $log_tables .= " $aryA[0]";
} }
+11 -2
View File
@@ -4,10 +4,11 @@
# #
# This script gathers several system metrics and stores them in the MySQL database # This script gathers several system metrics and stores them in the MySQL database
# #
# Copyright (C) 2024 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2026 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# #
# CHANGES # CHANGES
# 240217-2226 - First build # 240217-2226 - First build
# 260901-1011 - Look for mariadb-admin first, replacement for mysqladmin
# #
$start_epoch = time(); $start_epoch = time();
@@ -173,8 +174,14 @@ else
} }
} }
### find mysqladmin binary (database admin) ### find mysqladmin (or mariadb-admin) binary (database admin)
$mysqladminbin = ''; $mysqladminbin = '';
if ( -e ('/usr/bin/mariadb-admin')) {$mysqladminbin = '/usr/bin/mariadb-admin';}
else
{
if ( -e ('/bin/mariadb-admin')) {$mysqladminbin = '/bin/mariadb-admin';}
else
{
if ( -e ('/bin/mysqladmin')) {$mysqladminbin = '/bin/mysqladmin';} if ( -e ('/bin/mysqladmin')) {$mysqladminbin = '/bin/mysqladmin';}
else else
{ {
@@ -188,6 +195,8 @@ else
} }
} }
} }
}
}
### find wc binary (line and word count) ### find wc binary (line and word count)
$wcbin = ''; $wcbin = '';