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 8 |
4 |
%define rpmver 3.0.RC6 |
%define rpmver 3.0.RC6 |
5 |
|
|
6 |
epoch: 2 |
epoch: 2 |
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 |
%description |
%description |
23 |
This RPM is an unofficial addon for the SME Server 8.x. |
This RPM is an unofficial addon for the SME Server 9.x. |
24 |
The target audience is the Linux/E-smith administrator |
The target audience is the Linux/E-smith administrator |
25 |
who wants to backup their mysql databases with an automatic way. |
who wants to backup their mysql databases with an automatic way. |
26 |
This script is based on automysqlbackup V3.0 |
This script is based on automysqlbackup V3.0 |
28 |
|
|
29 |
|
|
30 |
%changelog |
%changelog |
31 |
|
* Sun Apr 02 2017 stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-8.sme |
32 |
|
- Added smeserver-automysqlbackup-AdjustableCronJob.patch |
33 |
|
- The time to run the Job is adjustable |
34 |
|
|
35 |
* 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 |
36 |
- Added 'epoch: 2' |
- Added 'epoch: 2' |
37 |
|
|
53 |
rm -rf $RPM_BUILD_ROOT |
rm -rf $RPM_BUILD_ROOT |
54 |
|
|
55 |
%setup |
%setup |
56 |
|
%patch0 -p1 |
57 |
|
|
58 |
%build |
%build |
59 |
|
perl createlinks |
60 |
|
|
61 |
%install |
%install |
62 |
/bin/rm -rf $RPM_BUILD_ROOT |
/bin/rm -rf $RPM_BUILD_ROOT |
63 |
(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) |
64 |
/bin/rm -f %{name}-%{version}-filelist |
/bin/rm -f %{name}-%{version}-filelist |
65 |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist |
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \ |
66 |
|
--file /sbin/e-smith/runmysqlbackup 'attr(0750,root,root)' \ |
67 |
|
> %{name}-%{version}-filelist |
68 |
|
|
69 |
|
|
70 |
%files -f %{name}-%{version}-filelist |
%files -f %{name}-%{version}-filelist |
81 |
MYSQLUSER=backupuser |
MYSQLUSER=backupuser |
82 |
# Expland template |
# Expland template |
83 |
/etc/e-smith/events/actions/initialize-default-databases |
/etc/e-smith/events/actions/initialize-default-databases |
84 |
|
/sbin/e-smith/expand-template /etc/cron.d/runmysqlbackup |
|
echo "=========================================================================================" |
|
|
echo " Your Databases are saved in /root/backup/db " |
|
|
echo " only Root can access to these folders" |
|
|
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 "=========================================================================================" |
|
|
|
|
|
|
|
85 |
|
|
86 |
#create backupuser and give rights |
#create backupuser and give rights |
87 |
MYSQLPASS=$(/sbin/e-smith/config getprop $SMEDB DbPassword) |
MYSQLPASS=$(/sbin/e-smith/config getprop $SMEDB DbPassword) |