/[smecontribs]/rpms/smeserver-automysqlbackup/contribs9/smeserver-automysqlbackup.spec
ViewVC logotype

Diff of /rpms/smeserver-automysqlbackup/contribs9/smeserver-automysqlbackup.spec

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

Revision 1.4 by stephdl, Sun Apr 2 16:57:21 2017 UTC Revision 1.5 by jcrisp, Wed Jul 11 23:03:52 2018 UTC
# Line 1  Line 1 
1  %define name smeserver-automysqlbackup  %define name smeserver-automysqlbackup
2  %define version 3.0.RC6  %define version 3.0.RC6
3  %define release 8  %define release 9
4  %define rpmver   3.0.RC6  %define rpmver   3.0.RC6
5    
6  epoch: 2  epoch: 2
# Line 19  Requires:              pax Line 19  Requires:              pax
19  Requires: automysqlbackup  Requires: automysqlbackup
20  BuildRequires:      e-smith-devtools  BuildRequires:      e-smith-devtools
21  Patch0: smeserver-automysqlbackup-AdjustableCronJob.patch  Patch0: smeserver-automysqlbackup-AdjustableCronJob.patch
22    Patch1: smeserver-automysqlbackup-enhanced-templates.patch
23  %description  %description
24  This RPM is an unofficial addon for the SME Server 9.x.    This RPM is an unofficial addon for the SME Server 9.x.  
25  The target audience is the Linux/E-smith administrator  The target audience is the Linux/E-smith administrator
# Line 28  This script is based on automysqlbackup Line 29  This script is based on automysqlbackup
29    
30    
31  %changelog  %changelog
32    * Fri Jul 06 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-9.sme
33    - Template configuration files
34    - run automysqlbackup per conf directly from cron rather than runmysqlbackup
35    - Add extra DB keys for mysql53, mysql55, mysql57
36    
37  * Sun Apr 02 2017 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-8.sme  * Sun Apr 02 2017 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-8.sme
38  - Added smeserver-automysqlbackup-AdjustableCronJob.patch  - Added smeserver-automysqlbackup-AdjustableCronJob.patch
39  - The time to run the Job is adjustable  - The time to run the Job is adjustable
# Line 54  rm -rf $RPM_BUILD_ROOT Line 60  rm -rf $RPM_BUILD_ROOT
60    
61  %setup  %setup
62  %patch0 -p1  %patch0 -p1
63    %patch1 -p1
64    
65  %build  %build
66  perl createlinks  perl createlinks
# Line 83  MYSQLUSER=backupuser Line 90  MYSQLUSER=backupuser
90  /etc/e-smith/events/actions/initialize-default-databases  /etc/e-smith/events/actions/initialize-default-databases
91  /sbin/e-smith/expand-template /etc/cron.d/runmysqlbackup  /sbin/e-smith/expand-template /etc/cron.d/runmysqlbackup
92    
93    echo "***********************************************************************"
94    echo "  "
95    echo "Creating backup user for default mysql53 database"
96  #create backupuser and give rights  #create backupuser and give rights
97  MYSQLPASS=$(/sbin/e-smith/config getprop $SMEDB DbPassword)  MYSQLPASS=$(/sbin/e-smith/config getprop $SMEDB DbPassword)
98  mysql -e " GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@'localhost' "  mysql -e " GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@'localhost' "
99  mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) "  mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) "
100  mysqladmin flush-privileges  mysqladmin flush-privileges
101  /etc/rc.d/init.d/mysql.init start  /etc/rc.d/init.d/mysql.init start
102    echo "done"
103    echo "*** If you add mysql55/mysql57 you must add a backup user ***"
104    echo "You can use the password from config show automysqlbackup"
105    echo "e.g.: "
106    echo "mysql55 -e \" GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@\'localhost\' \" "
107    echo "mysql55 -u root -e \"SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( \'$MYSQLPASS\' ) \" "
108    echo "  "
109    echo "***********************************************************************"
110    
111  #protect the backup folder  #protect the backup folder
112  chmod -R 700 /root/backup/db  chmod -R 700 /root/backup/db
# Line 99  if [ $1 = 0 ] ; then Line 117  if [ $1 = 0 ] ; then
117  SMEDB=automysqlbackup  SMEDB=automysqlbackup
118  MYSQLUSER=backupuser  MYSQLUSER=backupuser
119  echo "======================================================================="  echo "======================================================================="
120  echo "  delete mysql user and revoque all permissions"  echo "  "
121    echo "  delete mysql user and revoke all permissions"
122  # This section deletes backupuser  # This section deletes backupuser
123  mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$MYSQLUSER'@'localhost';"  mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$MYSQLUSER'@'localhost';"
124  mysql -u root -e "DROP USER $MYSQLUSER@localhost;"  mysql -u root -e "DROP USER $MYSQLUSER@localhost;"
125  echo "  "  echo "  "
126    echo "Do that for each DB - e.g mysq55, mysql57 etc"
127    echo "  "
128  # Delete custom template fragment  # Delete custom template fragment
129  echo "  delete db configuration automysqlbackup"  echo "  delete db configuration automysqlbackup"
130    echo "  "
131  echo "======================================================================="  echo "======================================================================="
132    
133  /sbin/e-smith/config delete $SMEDB  /sbin/e-smith/config delete $SMEDB


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed