https://bugs.contribs.org/show_bug.cgi?id=10806

            Bug ID: 10806
           Summary: error emails; lot of daily noise : 4 bugs
    Classification: Contribs
           Product: SME Contribs
           Version: 9.2
          Hardware: ---
                OS: ---
            Status: CONFIRMED
          Severity: normal
          Priority: P3
         Component: smeserver-automysqlbackup
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
  Target Milestone: ---

with last updates I receive the following errors every days

subject : ERRORS REPORTED: MySQL Backup error Log for HOST - 2019-09-03_04h01m
find:
`/root/backup/db/daily/horde/daily_horde_2019-08-26_04h01m_Monday.sql.gz': No
such file or directory
rm: cannot remove
`/root/backup/db/daily/matomo/daily_matomo_2019-08-26_04h01m_Monday.sql.gz': No
such file or directory
rm: cannot remove
`/root/backup/db/daily/mysql/daily_mysql_2019-08-27_04h01m_Tuesday.sql.gz': No
such file or directory
rm: cannot remove
`/root/backup/db/daily/wikimedicatest/daily_wikimedicatest_2019-08-27_04h01m_Tuesday.sql.gz':
No such file or directory



subject: ERRORS REPORTED: MySQL Backup error Log for HOST - 2019-09-03_04h01m
rm: cannot remove
`/root/backup/db/daily/matomo/daily_matomo_2019-08-27_04h01m_Tuesday.sql.gz':
No such file or directory
rm: cannot remove
`/root/backup/db/daily/mysql/daily_mysql_2019-08-26_04h01m_Monday.sql.gz': No
such file or directory

also 

subject: Cron <root@geme> /sbin/e-smith/runmysqlbackup
/etc/automysqlbackup/myserver.conf > /dev/null
chown: changement de propriétaire pour «
/root/backup/db/ERRORS_localhost-102292655.log »: Aucun fichier ou dossier de
ce type
chown: changement de propriétaire pour «
/root/backup/db/localhost-100894736.log »: Aucun fichier ou dossier de ce type

========================================================================

1/ First the chown /chmod : 
from the two first emails, it looks to me that the script is running twice...
and both time there is an error when it try to purge... let'S ignore it for the
moment the rm ones might be upstream bug, apart from the repetition 

from the last one there is something similar but from within the script
/sbin/e-smith/runmysqlbackup . Is it noise ? 

Only thing I see is a race condition or the "*" is the responsible with script
running twice at the same time creating a race condition :
chown root:root $DB* -R

you should get the full path of the db backup dir,  you can give it as argument
in the cron command, or get it from the conf file we get from the cron command
too !! but in the second way you have the issue that the conf file does not
have it directly...

and if we do not have any valid path then the command SHOULD NOT be run ? do
you want to chmod 400 / ???? so maybe a protection to avoid the chmod /chown it
the path does not exist or is /.


plus this should point only to the current db backup dir to avoid to chmod and
chown all directories multiple times when the script is called for 2 or more
db...

============================================================================
2/having it running multiple time

ll /etc/e-smith/templates/etc/cron.d/runmysqlbackup/
total 16
-rw-r--r-- 1 root root 301 27 nov.   2018 10base
-rw-r--r-- 1 root root 308 27 nov.   2018 20mysql55
-rw-r--r-- 1 root root 308 27 nov.   2018 21mysql57
-rw-r--r-- 1 root root 316 27 nov.   2018 22mymaria


with 21mysql57
{
my $my57 = ${'mysql57-mysqld'}{'status'} || 'disabled';

return '' unless $my57 eq 'enabled';
my $minutes= ${'automysqlbackup'}{'Minute'}||'1';
my $hours= ${'automysqlbackup'}{'Hour'}||'3';
$OUT = "$minutes $hours * * * root /sbin/e-smith/runmysqlbackup
/etc/automysqlbackup/mysql57.conf > /dev/null\n";

}


###> in other word if the server mysql57 is installed the line appear :
# cat /etc/cron.d/runmysqlbackup 
1 4 * * * root /sbin/e-smith/runmysqlbackup /etc/automysqlbackup/myserver.conf
> /dev/null
1 4 * * * root /sbin/e-smith/runmysqlbackup /etc/automysqlbackup/mysql57.conf >
/dev/null


why 2 lines ? why at the same hour ? this could lead to overload of the server.

This HAS to be in one fragment and give the following

1 4 * * * root /sbin/e-smith/runmysqlbackup /etc/automysqlbackup/myserver.conf
> /dev/null ; /sbin/e-smith/runmysqlbackup /etc/automysqlbackup/mysql57.conf >
/dev/null

hence the two backups occurs one after the other. I have a server with a lot of
load that if now crazy because of that for 1 hour every morning and because to
timezone this has impact on users.

============================================
3/ the conf files are not responding to the same condition as the cron:
# config show automysqlbackup 
automysqlbackup=webapp
    Mymaria=disabled
    Mysql53=enabled
    Mysql55=disabled
    Mysql57=disabled

hence while the cron is launching another instance; here is the conf file: 
# cat /etc/automysqlbackup/mysql57.conf
#------------------------------------------------------------
#              !!DO NOT MODIFY THIS FILE!!
# 
# Manual changes will be lost when this file is regenerated.
#
# Please read the developer's guide, which is available
# at http://www.contribs.org/development/
#
# Copyright (C) 1999-2006 Mitel Networks Corporation
#------------------------------------------------------------
#version=3.0_rc2
# DONT'T REMOVE THE PREVIOUS VERSION LINE!
# Automysqlbackup disabled


leading to a double chown / chmod without any backup of mysql57

my $my57 = ${'mysql57-mysqld'}{'status'} || 'disabled';
my $myauto = ${'automysqlbackup'}{'Mysql57'} || 'disabled';


the same logic should be present in both fragments, and it should be the
following :

if not installed nothing done
if installed backup, unless we deactivated the backup

my $my57 = ${'mysql57-mysqld'}{'status'} || 'disabled';
my $myauto = ${'automysqlbackup'}{'Mysql57'} || 'enabled';
our $status =  ($$my57 eq 'enabled' && $myauto eq 'enabled') ? 'enabled' :
'disabled;

then in all the fragment for this template just use if ($status eq "enabled") 
or 
return "#disabled" unless  $status eq "enabled";

after updating 

/etc/e-smith/templates/etc/automysqlbackup/mymaria.conf  

/etc/e-smith/templates/etc/automysqlbackup/myserver.conf/ 

/etc/e-smith/templates/etc/automysqlbackup/mysql55.conf/  

/etc/e-smith/templates/etc/automysqlbackup/mysql57.conf/

/etc/e-smith/templates/etc/cron.d/runmysqlbackup/

then you will need to make a migrate fragment to default automysqlbackup=webapp
    Mymaria=disabled
    Mysql53=enabled
    Mysql55=disabled
    Mysql57=disabled

to empty as default and let user set it with enabled or disabled + pay
attention to always let enabled as default.



=============================================
4/ default mysql is mysql5.1, not 5.3 so you should migrate the key Mysql53 to
Mysql51
# rpm -q mysql-server
mysql-server-5.1.73-8.el6_8.x86_64

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
_______________________________________________
Mail for each SME Contribs bug report
To unsubscribe, e-mail [email protected]
Searchable archive at https://lists.contribs.org/mailman/public/contribteam/

Reply via email to