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

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

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


Revision 1.2 - (show annotations) (download)
Sat Aug 22 18:10:51 2015 UTC (8 years, 9 months ago) by stephdl
Branch: MAIN
CVS Tags: smeserver-automysqlbackup-3_0_RC6-5_el6_sme
Changes since 1.1: +10 -6 lines
Sat Aug 22 2015 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-5.sme - Initial release to contribs9

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

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