/[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.1 - (hide annotations) (download)
Tue Jun 17 19:01:17 2014 UTC (10 years, 4 months ago) by unnilennium
Branch: MAIN
CVS Tags: smeserver-automysqlbackup-3_0_RC7-1_el6_sme, smeserver-automysqlbackup-3_0_RC7-1
Initial import to v9

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

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