initial commit of file from CVS for smeserver-automysqlbackup on Sat Sep 7 20:08:47 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 20:08:47 +10:00
parent c5b27eeb06
commit 010b2f680a
63 changed files with 1943 additions and 2 deletions

35
additional/CHANGELOG.git Normal file
View File

@@ -0,0 +1,35 @@
commit a024bf4f004ba017718344b0a9eb7b5ed0156421
Author: Stephane de Labrusse <stephdl@de-labrusse.fr>
Date: Sun Aug 17 22:32:37 2014 +0200
added my own patch against --events warning
commit e71becc50d7cee6c379d0438043e48809d0ed246
Author: Stephane de Labrusse <stephdl@de-labrusse.fr>
Date: Sun May 18 11:47:58 2014 +0200
added all files to git
commit da5aba0ea2abe63fd34f45f4c29889be5859721c
Author: Stephane de Labrusse <stephdl@de-labrusse.fr>
Date: Mon Mar 31 18:19:09 2014 +0200
#renamed: smeserver-automysqlbackup-3.0.RC6.spec -> smeserver-automysqlbackup.spec
commit 7d8485b7130ceb8715fa07a457656f5582537f81
Author: Stephane de Labrusse <stephdl@de-labrusse.fr>
Date: Sat Mar 29 20:35:41 2014 +0100
added .gitignore to empty folders
commit c9af02fe9f5e9f28d8b5e9a3e2aa4b451e6c0d7d
Author: Stephane de Labrusse <stephdl@de-labrusse.fr>
Date: Fri Mar 28 20:53:16 2014 +0100
initial release
commit 47c18db2cbc36a505b03759e4ced97acce9face7
Author: Stéphane de Labrusse <stephdl@de-labrusse.fr>
Date: Fri Mar 28 07:47:25 2014 -0700
Initial commit

2
additional/README.md Normal file
View File

@@ -0,0 +1,2 @@
smeserver-automysqlbackup
=========================

View File

@@ -0,0 +1,133 @@
%define name smeserver-automysqlbackup
%define version 3.0.RC6
%define release 4
%define rpmver 3.0.RC6
Summary: automysqlbackup is a script to backup your msql database on sme8
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
License: GPL
Group: /Web/Application
Source: %{name}-%{version}.tar.gz
URL: http://sourceforge.net/projects/automysqlbackup/
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
BuildArchitectures: noarch
Requires: e-smith-base, e-smith-release >= 8
Requires: pax
Requires: automysqlbackup
BuildRequires: e-smith-devtools
%description
This RPM is an unofficial addon for the SME Server 8.x.
The target audience is the Linux/E-smith administrator
who wants to backup their mysql databases with an automatic way.
This script is based on automysqlbackup V3.0
%changelog
* Sun Aug 17 2014 Stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6-4
- added my own patch against the --events warning
--Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.
* Sun Oct 27 2013 Stephane de Labrusse <stephdl@de-labrusse.fr> 3.0.RC6.3
- split the contrib in two versions smeserver-automysqlbackup and automysqlbackup
* Mon Apr 22 2013 Stephane de Labrusse <stephdl@de-labrusse.fr>
- [3.0.RC6] version Based on automysqlbackup V3.0 RC6
* Mon Apr 08 2013 Stephane de Labrusse <stephdl@de-labrusse.fr>
- [0.01] Initial version Based on automysqlbackup V3.0 RC6
%prep
rm -rf $RPM_BUILD_ROOT
%setup
%build
%install
/bin/rm -rf $RPM_BUILD_ROOT
(cd root ;/usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT)
/bin/rm -f %{name}-%{version}-filelist
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist
%files -f %{name}-%{version}-filelist
%defattr(-,root,root)
%clean
rm -rf $RPM_BUILD_ROOT
%pre
%post
SMEDB=automysqlbackup
MYSQLUSER=backupuser
# Expland template
/etc/e-smith/events/actions/initialize-default-databases
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 "========================================================================================="
#create backupuser and give rights
MYSQLPASS=$(/sbin/e-smith/config getprop $SMEDB DbPassword)
mysql -e " GRANT EVENT,SELECT,LOCK TABLES ON *.* TO $MYSQLUSER@'localhost' "
mysql -u root -e "SET PASSWORD FOR $MYSQLUSER@localhost = PASSWORD( '$MYSQLPASS' ) "
mysqladmin flush-privileges
/etc/rc.d/init.d/mysql.init start
#protect the backup folder
chmod -R 700 /root/backup/db
%preun
%postun
if [ $1 = 0 ] ; then
SMEDB=automysqlbackup
MYSQLUSER=backupuser
echo "======================================================================="
echo " delete mysql user and revoque all permissions"
# This section deletes backupuser
mysql -u root -e "REVOKE ALL PRIVILEGES ON *.* FROM '$MYSQLUSER'@'localhost';"
mysql -u root -e "DROP USER $MYSQLUSER@localhost;"
echo " "
# Delete custom template fragment
echo " delete db configuration automysqlbackup"
echo "======================================================================="
/sbin/e-smith/config delete $SMEDB
fi