--- rpms/smeserver-automysqlbackup/contribs9/smeserver-automysqlbackup.spec 2017/04/02 16:57:21 1.4 +++ rpms/smeserver-automysqlbackup/contribs9/smeserver-automysqlbackup.spec 2018/07/11 23:03:52 1.5 @@ -1,6 +1,6 @@ %define name smeserver-automysqlbackup %define version 3.0.RC6 -%define release 8 +%define release 9 %define rpmver 3.0.RC6 epoch: 2 @@ -19,6 +19,7 @@ Requires: pax Requires: automysqlbackup BuildRequires: e-smith-devtools Patch0: smeserver-automysqlbackup-AdjustableCronJob.patch +Patch1: smeserver-automysqlbackup-enhanced-templates.patch %description This RPM is an unofficial addon for the SME Server 9.x. The target audience is the Linux/E-smith administrator @@ -28,6 +29,11 @@ This script is based on automysqlbackup %changelog +* 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 @@ -54,6 +60,7 @@ rm -rf $RPM_BUILD_ROOT %setup %patch0 -p1 +%patch1 -p1 %build perl createlinks @@ -83,12 +90,23 @@ MYSQLUSER=backupuser /etc/e-smith/events/actions/initialize-default-databases /sbin/e-smith/expand-template /etc/cron.d/runmysqlbackup +echo "***********************************************************************" +echo " " +echo "Creating backup user for default mysql53 database" #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 +echo "done" +echo "*** If you add mysql55/mysql57 you must add a backup user ***" +echo "You can use the password from config show automysqlbackup" +echo "e.g.: " +echo "mysql55 -e \" GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@\'localhost\' \" " +echo "mysql55 -u root -e \"SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( \'$MYSQLPASS\' ) \" " +echo " " +echo "***********************************************************************" #protect the backup folder chmod -R 700 /root/backup/db @@ -99,13 +117,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