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

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

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


Revision 1.3 - (hide annotations) (download)
Wed Sep 16 20:50:45 2015 UTC (9 years, 1 month ago) by stephdl
Branch: MAIN
CVS Tags: smeserver-automysqlbackup-3_0_RC6-6_el6_sme
Changes since 1.2: +5 -2 lines
* Wed Sep 16 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-6.sme
- Added 'epoch: 2'

1 unnilennium 1.1 %define name smeserver-automysqlbackup
2 stephdl 1.2 %define version 3.0.RC6
3 stephdl 1.3 %define release 6
4 unnilennium 1.1 %define rpmver 3.0.RC6
5    
6 stephdl 1.3 epoch: 2
7 unnilennium 1.1 Summary: automysqlbackup is a script to backup your msql database on sme8
8     Name: %{name}
9     Version: %{version}
10     Release: %{release}%{?dist}
11     License: GPL
12     Group: /Web/Application
13     Source: %{name}-%{version}.tar.gz
14     URL: http://sourceforge.net/projects/automysqlbackup/
15     BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
16     BuildArchitectures: noarch
17     Requires: e-smith-base, e-smith-release >= 8
18     Requires: pax
19     Requires: automysqlbackup
20     BuildRequires: e-smith-devtools
21    
22     %description
23     This RPM is an unofficial addon for the SME Server 8.x.
24     The target audience is the Linux/E-smith administrator
25     who wants to backup their mysql databases with an automatic way.
26     This script is based on automysqlbackup V3.0
27    
28    
29    
30     %changelog
31 stephdl 1.3 * Wed Sep 16 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-6.sme
32     - Added 'epoch: 2'
33    
34 stephdl 1.2 * Sat Aug 22 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-5.sme
35     - Initial release to contribs9
36    
37     * Sun Aug 17 2014 Stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-4
38     - added my own patch against the --events warning
39     --Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.
40 unnilennium 1.1
41     * Sun Oct 27 2013 Stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6.3
42     - split the contrib in two versions smeserver-automysqlbackup and automysqlbackup
43     * Mon Apr 22 2013 Stephane de Labrusse <stephdl@de-labrusse.fr>
44     - [3.0.RC6] version Based on automysqlbackup V3.0 RC6
45     * Mon Apr 08 2013 Stephane de Labrusse <stephdl@de-labrusse.fr>
46     - [0.01] Initial version Based on automysqlbackup V3.0 RC6
47    
48     %prep
49     rm -rf $RPM_BUILD_ROOT
50    
51     %setup
52    
53     %build
54    
55     %install
56     /bin/rm -rf $RPM_BUILD_ROOT
57 stephdl 1.2 (cd root ;/usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT)
58 unnilennium 1.1 /bin/rm -f %{name}-%{version}-filelist
59     /sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist
60    
61    
62     %files -f %{name}-%{version}-filelist
63    
64     %defattr(-,root,root)
65    
66     %clean
67     rm -rf $RPM_BUILD_ROOT
68    
69     %pre
70    
71     %post
72     SMEDB=automysqlbackup
73     MYSQLUSER=backupuser
74     # Expland template
75     /etc/e-smith/events/actions/initialize-default-databases
76    
77     echo "========================================================================================="
78     echo " Your Databases are saved in /root/backup/db "
79     echo " only Root can access to these folders"
80     echo " a mail is send to Admin for all logs "
81     echo " "
82     echo " Configuration file is /etc/automysqlbackup/myserver.conf"
83     echo " "
84     echo " For a manual play you can use directly"
85     echo " automysqlbackup /etc/automysqlbackup/myserver.conf "
86     echo " else backups are done every night at 04H00 AM with /etc/cron.daily/runmysqlbackup"
87     echo "========================================================================================="
88     echo " RESTORING"
89     echo " In a root terminal"
90     echo " cd /root/backup/db/ and choose your backup"
91     echo " gunzip file-name.sql.gz"
92     echo " Next you will need to use the mysql client to restore the DB from the sql file."
93     echo " mysql database < /path/file.sql"
94     echo " NOTE: Make sure you use < and not > in the above command because you are piping the file.sql"
95     echo " to mysql and not the other way around"
96     echo "========================================================================================="
97     echo " Some db configuration for handle this contrib"
98     echo " Mailcontent (stdout/log/files/quiet)"
99     echo " # What would you like to be mailed to you?"
100     echo " # - log : send only log file (default)"
101     echo " # - files : send log file and sql files as attachments (see docs)"
102     echo " #- stdout : will simply output the log to the screen if run manually."
103     echo " #- quiet : Only send logs if an error occurs to the MAILADDR."
104     echo " Sizemail=8000 (bytes)"
105     echo " Mailto=root (or any other user@domaine.com)"
106     echo " Backupdir=path to the folder where mysql files are saved"
107     echo " "
108     echo " ex: config setprop automysqlbackup Mailcontent files"
109     echo "========================================================================================="
110    
111    
112    
113     #create backupuser and give rights
114     MYSQLPASS=$(/sbin/e-smith/config getprop $SMEDB DbPassword)
115 stephdl 1.2 mysql -e " GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@'localhost' "
116 unnilennium 1.1 mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) "
117     mysqladmin flush-privileges
118     /etc/rc.d/init.d/mysql.init start
119    
120     #protect the backup folder
121     chmod -R 700 /root/backup/db
122    
123     %preun
124     %postun
125     if [ $1 = 0 ] ; then
126     SMEDB=automysqlbackup
127     MYSQLUSER=backupuser
128     echo "======================================================================="
129     echo " delete mysql user and revoque all permissions"
130     # This section deletes backupuser
131     mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$MYSQLUSER'@'localhost';"
132     mysql -u root -e "DROP USER $MYSQLUSER@localhost;"
133     echo " "
134     # Delete custom template fragment
135     echo " delete db configuration automysqlbackup"
136     echo "======================================================================="
137    
138     /sbin/e-smith/config delete $SMEDB
139     fi

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