initial commit of file from CVS for smeserver-automysqlbackup on Sat Sep 7 20:08:47 AEST 2024
This commit is contained in:
@@ -0,0 +1 @@
|
||||
/root/backup/db
|
@@ -0,0 +1 @@
|
||||
01234567899876543210
|
@@ -0,0 +1 @@
|
||||
no
|
@@ -0,0 +1 @@
|
||||
4
|
@@ -0,0 +1 @@
|
||||
log
|
@@ -0,0 +1 @@
|
||||
root
|
@@ -0,0 +1 @@
|
||||
1
|
@@ -0,0 +1 @@
|
||||
8000
|
@@ -0,0 +1 @@
|
||||
service
|
17
root/etc/e-smith/db/configuration/migrate/85automysqlbackup
Normal file
17
root/etc/e-smith/db/configuration/migrate/85automysqlbackup
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
|
||||
my $rec = $DB->get('automysqlbackup') || $DB->new_record('automysqlbackup', { type => 'webapp' });
|
||||
my $pw = $rec->prop('DbPassword');
|
||||
|
||||
if (not $pw){
|
||||
$pw = `/usr/bin/openssl rand -base64 60 | tr -c -d '[:graph:]'`;
|
||||
chomp($pw);
|
||||
$rec->set_prop('DbPassword', $pw);
|
||||
}
|
||||
|
||||
# if mysql53 exists; ie before tidying the contrib : there is no mysql53 on SME, 5.1 or 5.5
|
||||
#delete Mymaria Mysql53 Mysql55 Mysql57; so we use the default as hardcoded in scripts
|
||||
if ( defined $rec->prop('Mysql53') ){
|
||||
$rec->delete_prop($_) for ( qw(Mymaria Mysql53 Mysql55 Mysql57) );
|
||||
}
|
||||
}
|
@@ -0,0 +1 @@
|
||||
PERMS=0750
|
@@ -0,0 +1 @@
|
||||
PERMS=0750
|
@@ -0,0 +1 @@
|
||||
PERMS=0750
|
@@ -0,0 +1 @@
|
||||
PERMS=0750
|
@@ -0,0 +1 @@
|
||||
PERMS=0750
|
@@ -0,0 +1 @@
|
||||
PERMS=0750
|
@@ -0,0 +1 @@
|
||||
PERMS=0750
|
@@ -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";
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
||||
}
|
@@ -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";
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
||||
}
|
@@ -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";
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
||||
}
|
@@ -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";
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
||||
}
|
@@ -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";
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
||||
}
|
@@ -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";
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
||||
}
|
@@ -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
|
||||
}
|
||||
}
|
33
root/etc/e-smith/templates/etc/cron.d/runmysqlbackup/10base
Normal file
33
root/etc/e-smith/templates/etc/cron.d/runmysqlbackup/10base
Normal 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";
|
||||
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user