initial commit of file from CVS for smeserver-automysqlbackup on Sat Sep 7 20:08:47 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 20:08:47 +10:00
parent c5b27eeb06
commit 010b2f680a
63 changed files with 1943 additions and 2 deletions

View File

@@ -0,0 +1,31 @@
{
my $mymaria = ${'mariadb'}{'status'} || 'disabled';
my $myauto = ${'automysqlbackup'}{'Mymaria'} || 'enabled';
our $status = ( $mymaria eq 'enabled' && $myauto eq 'enabled' ) ? 'enabled' : 'disabled';
my $debug = ${'automysqlbackup'}{'debug'} || 'disabled';
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
#version=3.0_RC6
# DON'T REMOVE THE PREVIOUS VERSION LINE!
CONFIG_mysql_dump_username='backupuser'
CONFIG_mysql_dump_password=$PWDMYSQL
CONFIG_mysql_dump_host_friendly=$SYSTEMNAME
CONFIG_mysql_dump_create_database='yes'
_EOF
if ($debug eq 'enabled') {
$OUT .= "# Debug enabled\n";
$OUT .= "CONFIG_debug=\'1\'\n";
}
}
else {
$OUT .= "#version=3.0_RC6\n";
$OUT .= "# DON'T REMOVE THE PREVIOUS VERSION LINE!\n";
$OUT .= "# Automysqlbackup disabled\n";
$OUT .= "# To enable:";
$OUT .= "# config setprop automysqlbackup Mymaria enabled\n";
$OUT .= "# signal-event automysqlbackup-update\n";
}
}

View File

@@ -0,0 +1,12 @@
{
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
# DB Specific
CONFIG_backup_dir=${BACKUPDIR}_mymaria
CONFIG_mysql_dump_full_schema='no'
CONFIG_db_exclude=( 'performance_schema' 'information_schema' 'sys' )
CONFIG_mysql_dump_socket='/var/lib/mysql/mysql.sock'
# End
_EOF
}
}

View File

@@ -0,0 +1,14 @@
{
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
CONFIG_mailcontent=$MAILCONTENT
CONFIG_mail_maxattsize=$SIZEMAIL
CONFIG_mail_splitandtar='yes'
CONFIG_mail_address=$MAILTO
CONFIG_encrypt=$ENCRYPT
CONFIG_encrypt_password=$DBENCRYPT_PASSWORD
CONFIG_backup_local_files=($BACKUP_LOCAL_FILES)
umask 0077
_EOF
}
}

View File

@@ -0,0 +1,31 @@
{
my $mymaria = ${'mariadb101-mariadb'}{'status'} || 'disabled';
my $myauto = ${'automysqlbackup'}{'Mymaria101'} || 'enabled';
our $status = ( $mymaria eq 'enabled' && $myauto eq 'enabled' ) ? 'enabled' : 'disabled';
my $debug = ${'automysqlbackup'}{'debug'} || 'disabled';
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
#version=3.0_RC6
# DON'T REMOVE THE PREVIOUS VERSION LINE!
CONFIG_mysql_dump_username='backupuser'
CONFIG_mysql_dump_password=$PWDMYSQL
CONFIG_mysql_dump_host_friendly=$SYSTEMNAME
CONFIG_mysql_dump_create_database='yes'
_EOF
if ($debug eq 'enabled') {
$OUT .= "# Debug enabled\n";
$OUT .= "CONFIG_debug=\'1\'\n";
}
}
else {
$OUT .= "#version=3.0_RC6\n";
$OUT .= "# DON'T REMOVE THE PREVIOUS VERSION LINE!\n";
$OUT .= "# Automysqlbackup disabled\n";
$OUT .= "# To enable:\n";
$OUT .= "# config setprop automysqlbackup Mymaria101 enabled\n";
$OUT .= "# signal-event automysqlbackup-update\n";
}
}

View File

@@ -0,0 +1,12 @@
{
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
# DB Specific
CONFIG_backup_dir=${BACKUPDIR}_mymaria_101
CONFIG_mysql_dump_full_schema='no'
CONFIG_db_exclude=( 'performance_schema' 'information_schema' 'sys' )
CONFIG_mysql_dump_socket='/var/lib/mysql/mariadb101.sock'
# End
_EOF
}
}

View File

@@ -0,0 +1,14 @@
{
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
CONFIG_mailcontent=$MAILCONTENT
CONFIG_mail_maxattsize=$SIZEMAIL
CONFIG_mail_splitandtar='yes'
CONFIG_mail_address=$MAILTO
CONFIG_encrypt=$ENCRYPT
CONFIG_encrypt_password=$DBENCRYPT_PASSWORD
CONFIG_backup_local_files=($BACKUP_LOCAL_FILES)
umask 0077
_EOF
}
}

View File

@@ -0,0 +1,31 @@
{
my $mymaria = ${'mariadb102-mariadb'}{'status'} || 'disabled';
my $myauto = ${'automysqlbackup'}{'Mymaria102'} || 'enabled';
our $status = ( $mymaria eq 'enabled' && $myauto eq 'enabled' ) ? 'enabled' : 'disabled';
my $debug = ${'automysqlbackup'}{'debug'} || 'disabled';
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
#version=3.0_RC6
# DON'T REMOVE THE PREVIOUS VERSION LINE!
CONFIG_mysql_dump_username='backupuser'
CONFIG_mysql_dump_password=$PWDMYSQL
CONFIG_mysql_dump_host_friendly=$SYSTEMNAME
CONFIG_mysql_dump_create_database='yes'
_EOF
if ($debug eq 'enabled') {
$OUT .= "# Debug enabled\n";
$OUT .= "CONFIG_debug=\'1\'\n";
}
}
else {
$OUT .= "#version=3.0_RC6\n";
$OUT .= "# DON'T REMOVE THE PREVIOUS VERSION LINE!\n";
$OUT .= "# Automysqlbackup disabled\n";
$OUT .= "# To enable:\n";
$OUT .= "# config setprop automysqlbackup Mymaria102 enabled\n";
$OUT .= "# signal-event automysqlbackup-update\n";
}
}

View File

@@ -0,0 +1,12 @@
{
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
# DB Specific
CONFIG_backup_dir=${BACKUPDIR}_mymaria_102
CONFIG_mysql_dump_full_schema='no'
CONFIG_db_exclude=( 'performance_schema' 'information_schema' 'sys' )
CONFIG_mysql_dump_socket='/var/lib/mysql/mariadb102.sock'
# End
_EOF
}
}

View File

@@ -0,0 +1,14 @@
{
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
CONFIG_mailcontent=$MAILCONTENT
CONFIG_mail_maxattsize=$SIZEMAIL
CONFIG_mail_splitandtar='yes'
CONFIG_mail_address=$MAILTO
CONFIG_encrypt=$ENCRYPT
CONFIG_encrypt_password=$DBENCRYPT_PASSWORD
CONFIG_backup_local_files=($BACKUP_LOCAL_FILES)
umask 0077
_EOF
}
}

View File

@@ -0,0 +1,31 @@
{
my $mymaria = ${'mariadb103-mariadb'}{'status'} || 'disabled';
my $myauto = ${'automysqlbackup'}{'Mymaria103'} || 'enabled';
our $status = ( $mymaria eq 'enabled' && $myauto eq 'enabled' ) ? 'enabled' : 'disabled';
my $debug = ${'automysqlbackup'}{'debug'} || 'disabled';
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
#version=3.0_RC6
# DON'T REMOVE THE PREVIOUS VERSION LINE!
CONFIG_mysql_dump_username='backupuser'
CONFIG_mysql_dump_password=$PWDMYSQL
CONFIG_mysql_dump_host_friendly=$SYSTEMNAME
CONFIG_mysql_dump_create_database='yes'
_EOF
if ($debug eq 'enabled') {
$OUT .= "# Debug enabled\n";
$OUT .= "CONFIG_debug=\'1\'\n";
}
}
else {
$OUT .= "#version=3.0_RC6\n";
$OUT .= "# DON'T REMOVE THE PREVIOUS VERSION LINE!\n";
$OUT .= "# Automysqlbackup disabled\n";
$OUT .= "# To enable:\n";
$OUT .= "# config setprop automysqlbackup Mymaria103 enabled\n";
$OUT .= "# signal-event automysqlbackup-update\n";
}
}

View File

@@ -0,0 +1,12 @@
{
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
# DB Specific
CONFIG_backup_dir=${BACKUPDIR}_mymaria_103
CONFIG_mysql_dump_full_schema='no'
CONFIG_db_exclude=( 'performance_schema' 'information_schema' 'sys' )
CONFIG_mysql_dump_socket='/var/lib/mysql/mariadb103.sock'
# End
_EOF
}
}

View File

@@ -0,0 +1,14 @@
{
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
CONFIG_mailcontent=$MAILCONTENT
CONFIG_mail_maxattsize=$SIZEMAIL
CONFIG_mail_splitandtar='yes'
CONFIG_mail_address=$MAILTO
CONFIG_encrypt=$ENCRYPT
CONFIG_encrypt_password=$DBENCRYPT_PASSWORD
CONFIG_backup_local_files=($BACKUP_LOCAL_FILES)
umask 0077
_EOF
}
}

View File

@@ -0,0 +1,31 @@
{
my $mymaria = ${'mariadb105-mariadb'}{'status'} || 'disabled';
my $myauto = ${'automysqlbackup'}{'Mymaria105'} || 'enabled';
our $status = ( $mymaria eq 'enabled' && $myauto eq 'enabled' ) ? 'enabled' : 'disabled';
my $debug = ${'automysqlbackup'}{'debug'} || 'disabled';
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
#version=3.0_RC6
# DON'T REMOVE THE PREVIOUS VERSION LINE!
CONFIG_mysql_dump_username='backupuser'
CONFIG_mysql_dump_password=$PWDMYSQL
CONFIG_mysql_dump_host_friendly=$SYSTEMNAME
CONFIG_mysql_dump_create_database='yes'
_EOF
if ($debug eq 'enabled') {
$OUT .= "# Debug enabled\n";
$OUT .= "CONFIG_debug=\'1\'\n";
}
}
else {
$OUT .= "#version=3.0_RC6\n";
$OUT .= "# DON'T REMOVE THE PREVIOUS VERSION LINE!\n";
$OUT .= "# Automysqlbackup disabled\n";
$OUT .= "# To enable:\n";
$OUT .= "# config setprop automysqlbackup Mymaria105 enabled\n";
$OUT .= "# signal-event automysqlbackup-update\n";
}
}

View File

@@ -0,0 +1,12 @@
{
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
# DB Specific
CONFIG_backup_dir=${BACKUPDIR}_mymaria_105
CONFIG_mysql_dump_full_schema='no'
CONFIG_db_exclude=( 'performance_schema' 'information_schema' 'sys' )
CONFIG_mysql_dump_socket='/var/lib/mysql/mariadb105.sock'
# End
_EOF
}
}

View File

@@ -0,0 +1,14 @@
{
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
CONFIG_mailcontent=$MAILCONTENT
CONFIG_mail_maxattsize=$SIZEMAIL
CONFIG_mail_splitandtar='yes'
CONFIG_mail_address=$MAILTO
CONFIG_encrypt=$ENCRYPT
CONFIG_encrypt_password=$DBENCRYPT_PASSWORD
CONFIG_backup_local_files=($BACKUP_LOCAL_FILES)
umask 0077
_EOF
}
}

View File

@@ -0,0 +1,31 @@
{
my $my57 = ${'mysql57-mysqld'}{'status'} || 'disabled';
my $myauto = ${'automysqlbackup'}{'Mysql57'} || 'enabled';
our $status = ( $my57 eq 'enabled' && $myauto eq 'enabled' ) ? 'enabled' : 'disabled';
my $debug = ${'automysqlbackup'}{'debug'} || 'disabled';
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
#version=3.0_RC6
# DON'T REMOVE THE PREVIOUS VERSION LINE!
CONFIG_mysql_dump_username='backupuser'
CONFIG_mysql_dump_password=$PWDMYSQL
CONFIG_mysql_dump_host_friendly=$SYSTEMNAME
CONFIG_mysql_dump_create_database='yes'
_EOF
if ($debug eq 'enabled') {
$OUT .= "# Debug enabled\n";
$OUT .= "CONFIG_debug=\'1\'\n";
}
}
else {
$OUT .= "#version=3.0_RC6\n";
$OUT .= "# DON'T REMOVE THE PREVIOUS VERSION LINE!\n";
$OUT .= "# Automysqlbackup disabled\n";
$OUT .= "# To enable:\n";
$OUT .= "# config setprop automysqlbackup Mysql57 enabled\n";
$OUT .= "# signal-event automysqlbackup-update\n";
}
}

View File

@@ -0,0 +1,12 @@
{
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
# DB Specific
CONFIG_backup_dir=${BACKUPDIR}_mysql57
CONFIG_mysql_dump_full_schema='no'
CONFIG_db_exclude=( 'information_schema' 'performance_schema' 'sys' )
CONFIG_mysql_dump_socket='/var/lib/mysql/mysql57.sock'
# End
_EOF
}
}

View File

@@ -0,0 +1,14 @@
{
if ($status eq 'enabled') {
$OUT .= <<'_EOF';
CONFIG_mailcontent=$MAILCONTENT
CONFIG_mail_maxattsize=$SIZEMAIL
CONFIG_mail_splitandtar='yes'
CONFIG_mail_address=$MAILTO
CONFIG_encrypt=$ENCRYPT
CONFIG_encrypt_password=$DBENCRYPT_PASSWORD
CONFIG_backup_local_files=($BACKUP_LOCAL_FILES)
umask 0077
_EOF
}
}

View File

@@ -0,0 +1,33 @@
{
my $mymaria = ${'mariadb'}{'status'} || 'disabled';
$mymaria = ( ( ( ${'automysqlbackup'}{'Mymaria'} || 'enabled' ) eq "enabled" ) and ( $mymaria eq "enabled") ) ? "enabled" : "disabled";
my $my57 = ${'mysql57-mysqld'}{'status'} || 'disabled';
$my57 = ( ( ( ${'automysqlbackup'}{'Mysql57'} || 'enabled' ) eq "enabled" ) and ( $my57 eq "enabled" ) ) ? "enabled" : "disabled";
my $my101 = ${'mariadb101-mariadb'}{'status'} || 'disabled';
$my101 = ( ( ( ${'automysqlbackup'}{'Mymaria101'} || 'enabled' ) eq "enabled" ) and ( $my101 eq "enabled" ) ) ? "enabled" : "disabled";
my $my102 = ${'mariadb102-mariadb'}{'status'} || 'disabled';
$my102 = ( ( ( ${'automysqlbackup'}{'Mymaria102'} || 'enabled' ) eq "enabled" ) and ( $my102 eq "enabled" ) ) ? "enabled" : "disabled";
my $my103 = ${'mariadb103-mariadb'}{'status'} || 'disabled';
$my103 = ( ( ( ${'automysqlbackup'}{'Mymaria101'} || 'enabled' ) eq "enabled" ) and ( $my103 eq "enabled" ) ) ? "enabled" : "disabled";
my $my105 = ${'mariadb105-mariadb'}{'status'} || 'disabled';
$my105 = ( ( ( ${'automysqlbackup'}{'Mymaria105'} || 'enabled' ) eq "enabled" ) and ( $my105 eq "enabled" ) ) ? "enabled" : "disabled";
#return '' unless $mymymaria eq 'enabled';
my $minutes= ${'automysqlbackup'}{'Minute'}||'1';
my $hours= ${'automysqlbackup'}{'Hour'}||'3';
$OUT = "$minutes $hours * * * root ";
$OUT .= "/sbin/e-smith/runmysqlbackup -bc /etc/automysqlbackup/mymaria.conf > /dev/null ; " if $mymaria eq "enabled";
$OUT .= "/sbin/e-smith/runmysqlbackup -bc /etc/automysqlbackup/mysql57.conf > /dev/null ; " if $my57 eq "enabled";
$OUT .= "/sbin/e-smith/runmysqlbackup -bc /etc/automysqlbackup/mymaria101.conf > /dev/null ; " if $my101 eq "enabled";
$OUT .= "/sbin/e-smith/runmysqlbackup -bc /etc/automysqlbackup/mymaria102.conf > /dev/null ; " if $my102 eq "enabled";
$OUT .= "/sbin/e-smith/runmysqlbackup -bc /etc/automysqlbackup/mymaria103.conf > /dev/null ; " if $my103 eq "enabled";
$OUT .= "/sbin/e-smith/runmysqlbackup -bc /etc/automysqlbackup/mymaria105.conf > /dev/null ; " if $my105 eq "enabled";
$OUT .= "\n";
}

View File

@@ -0,0 +1,37 @@
{
my $user = $automysqlbackup{'DbUser'} || 'backupuser';
my $pass = $automysqlbackup{'DbPassword'} || 'automysqlbackup';
my $status = ${'mysql.init'}{'status'} || 'disabled';
$OUT = "#! /bin/sh
";
if ( "$status" eq "enabled" ) {
$OUT .= <<"END";
HOME="/root/";
/usr/bin/mysql --socket=/var/lib/mysql/mysql.sock <<EOF
USE mysql;
REPLACE INTO user (
host,
user,
password)
VALUES (
'localhost',
'$user',
PASSWORD ('$pass'));
REVOKE ALL PRIVILEGES ON *.* FROM '$user'\@'localhost';
REVOKE GRANT OPTION ON *.* FROM '$user'\@'localhost';
GRANT EVENT,SELECT,LOCK TABLES, SHOW VIEW ON *.* TO '$user'\@'localhost' ;
FLUSH PRIVILEGES;
EOF
END
}
}

View File

@@ -0,0 +1,43 @@
{
my $user = $automysqlbackup{'DbUser'} || 'backupuser';
my $pass = $automysqlbackup{'DbPassword'} || 'automysqlbackup';
my $status = ${'mariadb101-mariadb'}{'status'} || 'disabled';
$OUT = "#! /bin/sh
";
if ( "$status" eq "enabled" ) {
$OUT .= <<"END";
HOME="/root/";
/opt/rh/rh-mariadb101/root/usr/bin/mysql --socket=/var/lib/mysql/mariadb101.sock <<EOF
USE mysql;
REPLACE INTO user (
host,
user,
authentication_string,
ssl_cipher,
x509_issuer,
x509_subject)
VALUES (
'localhost',
'$user',
PASSWORD ('$pass'),
'',
'',
'');
REVOKE ALL PRIVILEGES ON *.* FROM '$user'\@'localhost';
REVOKE GRANT OPTION ON *.* FROM '$user'\@'localhost';
GRANT EVENT,SELECT,LOCK TABLES, SHOW VIEW ON *.* TO '$user'\@'localhost' ;
FLUSH PRIVILEGES;
EOF
END
}
}

View File

@@ -0,0 +1,43 @@
{
my $user = $automysqlbackup{'DbUser'} || 'backupuser';
my $pass = $automysqlbackup{'DbPassword'} || 'automysqlbackup';
my $status = ${'mariadb102-mariadb'}{'status'} || 'disabled';
$OUT = "#! /bin/sh
";
if ( "$status" eq "enabled" ) {
$OUT .= <<"END";
HOME="/root/";
/opt/rh/rh-mariadb102/root/usr/bin/mysql --socket=/var/lib/mysql/mariadb102.sock <<EOF
USE mysql;
REPLACE INTO user (
host,
user,
authentication_string,
ssl_cipher,
x509_issuer,
x509_subject)
VALUES (
'localhost',
'$user',
PASSWORD ('$pass'),
'',
'',
'');
REVOKE ALL PRIVILEGES ON *.* FROM '$user'\@'localhost';
REVOKE GRANT OPTION ON *.* FROM '$user'\@'localhost';
GRANT EVENT,SELECT,LOCK TABLES, SHOW VIEW ON *.* TO '$user'\@'localhost' ;
FLUSH PRIVILEGES;
EOF
END
}
}

View File

@@ -0,0 +1,43 @@
{
my $user = $automysqlbackup{'DbUser'} || 'backupuser';
my $pass = $automysqlbackup{'DbPassword'} || 'automysqlbackup';
my $status = ${'mariadb103-mariadb'}{'status'} || 'disabled';
$OUT = "#! /bin/sh
";
if ( "$status" eq "enabled" ) {
$OUT .= <<"END";
HOME="/root/";
/opt/rh/rh-mariadb103/root/usr/bin/mysql --socket=/var/lib/mysql/mariadb103.sock <<EOF
USE mysql;
REPLACE INTO user (
host,
user,
authentication_string,
ssl_cipher,
x509_issuer,
x509_subject)
VALUES (
'localhost',
'$user',
PASSWORD ('$pass'),
'',
'',
'');
REVOKE ALL PRIVILEGES ON *.* FROM '$user'\@'localhost';
REVOKE GRANT OPTION ON *.* FROM '$user'\@'localhost';
GRANT EVENT,SELECT,LOCK TABLES, SHOW VIEW ON *.* TO '$user'\@'localhost' ;
FLUSH PRIVILEGES;
EOF
END
}
}

View File

@@ -0,0 +1,29 @@
{
my $user = $automysqlbackup{'DbUser'} || 'backupuser';
my $pass = $automysqlbackup{'DbPassword'} || 'automysqlbackup';
my $status = ${'mariadb105-mariadb'}{'status'} || 'disabled';
$OUT = "#! /bin/sh
";
if ( "$status" eq "enabled" ) {
$OUT .= <<"END";
HOME="/root/";
/opt/rh/rh-mariadb105/root/usr/bin/mysql --socket=/var/lib/mysql/mariadb105.sock <<EOF
USE mysql;
DROP USER IF EXISTS 'backupuser\@localhost';
DROP USER IF EXISTS '$user\@localhost';
CREATE USER IF NOT EXISTS '$user'\@'localhost' IDENTIFIED BY '$pass';
REVOKE ALL PRIVILEGES ON *.* FROM '$user'\@'localhost';
REVOKE GRANT OPTION ON *.* FROM '$user'\@'localhost';
GRANT EVENT,SELECT,LOCK TABLES, SHOW VIEW ON *.* TO '$user'\@'localhost' ;
FLUSH PRIVILEGES;
EOF
END
}
}

View File

@@ -0,0 +1,43 @@
{
my $user = $automysqlbackup{'DbUser'} || 'backupuser';
my $pass = $automysqlbackup{'DbPassword'} || 'automysqlbackup';
my $status = ${'mysql57-mysqld'}{'status'} || 'disabled';
$OUT = "#! /bin/sh
";
if ( "$status" eq "enabled" ) {
$OUT .= <<"END";
HOME="/root/";
/opt/rh/rh-mysql57/root/usr/bin/mysql --socket=/var/lib/mysql/mysql57.sock <<EOF
USE mysql;
REPLACE INTO user (
host,
user,
authentication_string,
ssl_cipher,
x509_issuer,
x509_subject)
VALUES (
'localhost',
'$user',
PASSWORD ('$pass'),
'',
'',
'');
REVOKE ALL PRIVILEGES ON *.* FROM '$user'\@'localhost';
REVOKE GRANT OPTION ON *.* FROM '$user'\@'localhost';
GRANT EVENT,SELECT,LOCK TABLES, SHOW VIEW ON *.* TO '$user'\@'localhost' ;
FLUSH PRIVILEGES;
EOF
END
}
}