--- rpms/smeserver-automysqlbackup/contribs9/smeserver-automysqlbackup.spec 2015/08/22 18:10:51 1.2 +++ rpms/smeserver-automysqlbackup/contribs9/smeserver-automysqlbackup.spec 2019/11/26 17:18:49 1.9 @@ -1,9 +1,9 @@ %define name smeserver-automysqlbackup %define version 3.0.RC6 -%define release 5 +%define release 13 %define rpmver 3.0.RC6 - +epoch: 2 Summary: automysqlbackup is a script to backup your msql database on sme8 Name: %{name} Version: %{version} @@ -14,13 +14,18 @@ Source: %{name}-%{version}.t URL: http://sourceforge.net/projects/automysqlbackup/ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot BuildArchitectures: noarch -Requires: e-smith-base, e-smith-release >= 8 +Requires: e-smith-base, e-smith-release >= 9 Requires: pax Requires: automysqlbackup BuildRequires: e-smith-devtools +Patch0: smeserver-automysqlbackup-AdjustableCronJob.patch +Patch1: smeserver-automysqlbackup-enhanced-templates.patch +Patch2: smeserver-automysqlbackup-fix-runmysql.patch +Patch3: smeserver-automysqlbackup-update-permission-change.patch +Patch4: smeserver-automysqlbackup-3.0.RC6-bz10806.errorsAndCreateUsers.patch %description -This RPM is an unofficial addon for the SME Server 8.x. +This RPM is an unofficial addon for the SME Server 9.x. The target audience is the Linux/E-smith administrator who wants to backup their mysql databases with an automatic way. This script is based on automysqlbackup V3.0 @@ -28,6 +33,37 @@ This script is based on automysqlbackup %changelog +* Sun Sep 22 2019 Jean-Philipe Pialasse 3.0.RC6-13.sme +- fix multiple cause of error noise and performance [SME: 10806] + * avoid parallel run of all backups, cron template rewritten + * avoid multiple parallel or repeated chmod and chown + * protect from undesired chmod or chown + * consistent use of status for cron and conf templates + * create backup user for mysql, mysql55 and mysql57 (Maria to do) + * update mysql53 use to mysql51 as variable + * migrate fragment to remove Mysql55 Mysql57 Mymaria Mysql53 if Mysql53 exist + * remove default value in db for Mysql55 Mysql57 Mymaria Mysql53 + * default as enabled in fragments for all automysql My* properties +- create default user in dbs [SME: 10808] + +* Mon Nov 26 2018 John Crisp 3.0.RC6-11.sme +- fix runmysqlscript to allow for change in Backupdir key [SME: 10655] + +* Mon Nov 26 2018 John Crisp 3.0.RC6-10.sme +- fix runmysqlbackup to allow for new databases [SME: 10654] + +* Fri Jul 06 2018 John Crisp 3.0.RC6-9.sme +- Template configuration files +- run automysqlbackup per conf directly from cron rather than runmysqlbackup +- Add extra DB keys for mysql53, mysql55, mysql57 + +* Sun Apr 02 2017 stephane de Labrusse 3.0.RC6-8.sme +- Added smeserver-automysqlbackup-AdjustableCronJob.patch +- The time to run the Job is adjustable + +* Wed Sep 16 2015 stephane de Labrusse 3.0.RC6-6.sme +- Added 'epoch: 2' + * Sat Aug 22 2015 stephane de Labrusse 3.0.RC6-5.sme - Initial release to contribs9 @@ -46,14 +82,22 @@ This script is based on automysqlbackup rm -rf $RPM_BUILD_ROOT %setup +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 %build +perl createlinks %install /bin/rm -rf $RPM_BUILD_ROOT (cd root ;/usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) /bin/rm -f %{name}-%{version}-filelist -/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist +/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ +--file /sbin/e-smith/runmysqlbackup 'attr(0750,root,root)' \ +> %{name}-%{version}-filelist %files -f %{name}-%{version}-filelist @@ -66,53 +110,6 @@ rm -rf $RPM_BUILD_ROOT %pre %post -SMEDB=automysqlbackup -MYSQLUSER=backupuser -# Expland template -/etc/e-smith/events/actions/initialize-default-databases - -echo "=========================================================================================" -echo " Your Databases are saved in /root/backup/db " -echo " only Root can access to these folders" -echo " a mail is send to Admin for all logs " -echo " " -echo " Configuration file is /etc/automysqlbackup/myserver.conf" -echo " " -echo " For a manual play you can use directly" -echo " automysqlbackup /etc/automysqlbackup/myserver.conf " -echo " else backups are done every night at 04H00 AM with /etc/cron.daily/runmysqlbackup" -echo "=========================================================================================" -echo " RESTORING" -echo " In a root terminal" -echo " cd /root/backup/db/ and choose your backup" -echo " gunzip file-name.sql.gz" -echo " Next you will need to use the mysql client to restore the DB from the sql file." -echo " mysql database < /path/file.sql" -echo " NOTE: Make sure you use < and not > in the above command because you are piping the file.sql" -echo " to mysql and not the other way around" -echo "=========================================================================================" -echo " Some db configuration for handle this contrib" -echo " Mailcontent (stdout/log/files/quiet)" -echo " # What would you like to be mailed to you?" -echo " # - log : send only log file (default)" -echo " # - files : send log file and sql files as attachments (see docs)" -echo " #- stdout : will simply output the log to the screen if run manually." -echo " #- quiet : Only send logs if an error occurs to the MAILADDR." -echo " Sizemail=8000 (bytes)" -echo " Mailto=root (or any other user@domaine.com)" -echo " Backupdir=path to the folder where mysql files are saved" -echo " " -echo " ex: config setprop automysqlbackup Mailcontent files" -echo "=========================================================================================" - - - -#create backupuser and give rights -MYSQLPASS=$(/sbin/e-smith/config getprop $SMEDB DbPassword) -mysql -e " GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@'localhost' " -mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) " -mysqladmin flush-privileges -/etc/rc.d/init.d/mysql.init start #protect the backup folder chmod -R 700 /root/backup/db @@ -123,13 +120,17 @@ if [ $1 = 0 ] ; then SMEDB=automysqlbackup MYSQLUSER=backupuser echo "=======================================================================" -echo " delete mysql user and revoque all permissions" +echo " " +echo " delete mysql user and revoke all permissions" # This section deletes backupuser mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$MYSQLUSER'@'localhost';" mysql -u root -e "DROP USER $MYSQLUSER@localhost;" echo " " +echo "Do that for each DB - e.g mysq55, mysql57 etc" +echo " " # Delete custom template fragment echo " delete db configuration automysqlbackup" +echo " " echo "=======================================================================" /sbin/e-smith/config delete $SMEDB