/[smecontribs]/rpms/smeserver-automysqlbackup/contribs8/smeserver-automysqlbackup-3.0.RC6.spec
ViewVC logotype

Contents of /rpms/smeserver-automysqlbackup/contribs8/smeserver-automysqlbackup-3.0.RC6.spec

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


Revision 1.1 - (show annotations) (download)
Mon Dec 30 07:10:55 2013 UTC (10 years, 11 months ago) by unnilennium
Branch: MAIN
CVS Tags: smeserver-automysqlbackup-3_0_RC6-3, smeserver-automysqlbackup-3_0_RC6-3_el5_sme
Initial import

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

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