/[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.3 by stephdl, Wed Sep 16 20:50:45 2015 UTC Revision 1.6 by jcrisp, Mon Nov 26 13:50:22 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 6  %define release 10
4  %define rpmver   3.0.RC6  %define rpmver   3.0.RC6
5    
6  epoch: 2  epoch: 2
# Line 14  Source:             %{name}-%{version}.t Line 14  Source:             %{name}-%{version}.t
14  URL:                http://sourceforge.net/projects/automysqlbackup/  URL:                http://sourceforge.net/projects/automysqlbackup/
15  BuildRoot:          /var/tmp/%{name}-%{version}-%{release}-buildroot  BuildRoot:          /var/tmp/%{name}-%{version}-%{release}-buildroot
16  BuildArchitectures: noarch  BuildArchitectures: noarch
17  Requires:           e-smith-base, e-smith-release >= 8  Requires:           e-smith-base, e-smith-release >= 9
18  Requires:               pax  Requires:               pax
19  Requires: automysqlbackup  Requires: automysqlbackup
20  BuildRequires:      e-smith-devtools  BuildRequires:      e-smith-devtools
21    Patch0: smeserver-automysqlbackup-AdjustableCronJob.patch
22    Patch1: smeserver-automysqlbackup-enhanced-templates.patch
23    Patch2: smeserver-automysqlbackup-fix-runmysql.patch
24    
25  %description  %description
26  This RPM is an unofficial addon for the SME Server 8.x.    This RPM is an unofficial addon for the SME Server 9.x.  
27  The target audience is the Linux/E-smith administrator  The target audience is the Linux/E-smith administrator
28  who wants to backup their mysql databases with an automatic way.  who wants to backup their mysql databases with an automatic way.
29  This script is based on automysqlbackup V3.0  This script is based on automysqlbackup V3.0
# Line 28  This script is based on automysqlbackup Line 31  This script is based on automysqlbackup
31    
32    
33  %changelog  %changelog
34    * Mon Nov 26 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-10.sme
35    - fix runmysqlbackup to allow for new databases [SME:10654]
36    
37    * Fri Jul 06 2018 John Crisp <jcrisp@safeandsoundit.co.uk> 3.0.RC6-9.sme
38    - Template configuration files
39    - run automysqlbackup per conf directly from cron rather than runmysqlbackup
40    - Add extra DB keys for mysql53, mysql55, mysql57
41    
42    * Sun Apr 02 2017 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-8.sme
43    - Added smeserver-automysqlbackup-AdjustableCronJob.patch
44    - The time to run the Job is adjustable
45    
46  * Wed Sep 16 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-6.sme  * Wed Sep 16 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-6.sme
47  - Added 'epoch: 2'  - Added 'epoch: 2'
48    
# Line 49  This script is based on automysqlbackup Line 64  This script is based on automysqlbackup
64  rm -rf $RPM_BUILD_ROOT  rm -rf $RPM_BUILD_ROOT
65    
66  %setup  %setup
67    %patch0 -p1
68    %patch1 -p1
69    %patch2 -p1
70    
71  %build  %build
72    perl createlinks
73    
74  %install  %install
75  /bin/rm -rf $RPM_BUILD_ROOT  /bin/rm -rf $RPM_BUILD_ROOT
76  (cd root   ;/usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT)  (cd root   ;/usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT)
77  /bin/rm -f %{name}-%{version}-filelist  /bin/rm -f %{name}-%{version}-filelist
78  /sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist  /sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
79    --file /sbin/e-smith/runmysqlbackup 'attr(0750,root,root)' \
80    > %{name}-%{version}-filelist
81    
82    
83  %files -f %{name}-%{version}-filelist  %files -f %{name}-%{version}-filelist
# Line 73  SMEDB=automysqlbackup Line 94  SMEDB=automysqlbackup
94  MYSQLUSER=backupuser  MYSQLUSER=backupuser
95  # Expland template  # Expland template
96  /etc/e-smith/events/actions/initialize-default-databases  /etc/e-smith/events/actions/initialize-default-databases
97    /sbin/e-smith/expand-template /etc/cron.d/runmysqlbackup
98    
99  echo "========================================================================================="  echo "***********************************************************************"
100  echo "  Your Databases are saved in /root/backup/db "  echo "  "
101  echo "  only Root can access to these folders"                          echo "Creating backup user for default mysql53 database"
 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 "========================================================================================="  
   
   
   
102  #create backupuser and give rights  #create backupuser and give rights
103  MYSQLPASS=$(/sbin/e-smith/config getprop $SMEDB DbPassword)  MYSQLPASS=$(/sbin/e-smith/config getprop $SMEDB DbPassword)
104  mysql -e " GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@'localhost' "  mysql -e " GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@'localhost' "
105  mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) "  mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) "
106  mysqladmin flush-privileges  mysqladmin flush-privileges
107  /etc/rc.d/init.d/mysql.init start  /etc/rc.d/init.d/mysql.init start
108    echo "done"
109    echo "*** If you add mysql55/mysql57 you must add a backup user ***"
110    echo "You can use the password from config show automysqlbackup"
111    echo "e.g.: "
112    echo "mysql55 -e \" GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@\'localhost\' \" "
113    echo "mysql55 -u root -e \"SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( \'$MYSQLPASS\' ) \" "
114    echo "  "
115    echo "***********************************************************************"
116    
117  #protect the backup folder  #protect the backup folder
118  chmod -R 700 /root/backup/db  chmod -R 700 /root/backup/db
# Line 126  if [ $1 = 0 ] ; then Line 123  if [ $1 = 0 ] ; then
123  SMEDB=automysqlbackup  SMEDB=automysqlbackup
124  MYSQLUSER=backupuser  MYSQLUSER=backupuser
125  echo "======================================================================="  echo "======================================================================="
126  echo "  delete mysql user and revoque all permissions"  echo "  "
127    echo "  delete mysql user and revoke all permissions"
128  # This section deletes backupuser  # This section deletes backupuser
129  mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$MYSQLUSER'@'localhost';"  mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$MYSQLUSER'@'localhost';"
130  mysql -u root -e "DROP USER $MYSQLUSER@localhost;"  mysql -u root -e "DROP USER $MYSQLUSER@localhost;"
131  echo "  "  echo "  "
132    echo "Do that for each DB - e.g mysq55, mysql57 etc"
133    echo "  "
134  # Delete custom template fragment  # Delete custom template fragment
135  echo "  delete db configuration automysqlbackup"  echo "  delete db configuration automysqlbackup"
136    echo "  "
137  echo "======================================================================="  echo "======================================================================="
138    
139  /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