Most providers offer backups of the entire web space (database and files) as standard. The problem is that there is usually no guarantee for this (usually to be found in the provider's general terms and conditions). This means that in the worst case you may be left without a website or have to hope to find an old copy somewhere.
These are the advantages of our backup programme
For a complete TYPO3 backup, the following data must usually be backed up:
Since TYPO3 itself is available for download in almost every version, a complete backup of the typo3 folder is not necessary.
The programme is a bash script that runs under a suitable Unix environment.
2 different types of backups can be made:
The data is collected in a (tar) archive and then compressed in a password-protected way. Finally, a mail is sent to a stored address containing the most important data and any errors that may have occurred:
Ex.:
backup scope: database and files
number of errors in errorlog: 1 (see below)
size of database dump: 51M
complete size of backup: 415M
end of backup process: 2021-05-25_15:14:58
---------------------------------------------------------------------
Warning: Using a password on the command line interface can be insecure.
A mirroring of the data, in order to then also be independent of the server availability, is also no problem. The files can be played onto other servers at any time via a secure connection. Password protection provides additional security and ensures that only authorised employees have access to the data.
The backup programme can map almost any backup strategy with appropriate knowledge of shell programming.
The following concept is provided by default:
Note:
Please note that the backups may contain personal data (e.g. form data). For data protection reasons, these may generally only be stored for a certain period of time. (see also TYPO3 and DSGVO)
The programme is licensed under the GNU General Public License and is therefore provided free of charge. We charge the following costs for the installation:
Our performance | Non-Profit | Companies |
---|---|---|
Installation, implementation of a backup strategy, testing and commissioning | 390,00 € | 450,00 € |
Mirroring the data to another server | 195,00 € | 225,00 € |
Installation, implementation of a backup strategy, testing and commissioning | |
---|---|
Non-Profit: | 390,00 € |
Companies | 450,00 € |
Mirroring the data to another server | |
---|---|
Non-Profit: | 195,00 € |
Companies | 225,00 € |
You can use and adapt the code below. Please note the terms of the GNU GPL licence. In particular:
#!/bin/bash
# Copyright 2021 Oliver Wassenaar (WACON Internet GmbH)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details: <http://www.gnu.org/licenses/>.
# get command line parameter
for arg in "$@"
do
case $arg in
-d|--database)
DB_ONLY=1
shift
;;
-n|--nomail)
NO_MAIL=1
shift
shift
;;
esac
done
# config parameter
sitename=wacon
targetdir=<TARGETDIR>/backup
projectdir=<WEB_ROOTPATH>
backupfile=$sitename$(date +"%Y%m%d")_$$
dbfile=db.sql_$$
logfile=$targetdir/log/log_$$
errorlog=$targetdir/log/error_$$
mailtext=$targetdir/mailtxt_$$
# db credentials
dbname=<DB_NAME>
host=<DB_HOST>
user=<DB_USER>
password=<DB_PASSWORD>
# password of backup file
zippw=<MYPASSWD>
# comma separated list of mail receiver
mailreceiver="<TO_ADDRESS1>, <TO_ADDRESS2>, ..."
mailsender="<SENDER_ADDRESS>"
# delete all log files older than 30 days
find $targetdir/log -maxdepth 1 -type f -name '*' -mtime +30 -exec rm {} \;
exec 1>>$logfile 2>>$errorlog
echo "Begin backup: $(date +%F_%T)"
# delete all db backups older than 7 days (e.g. to run the db backup every day)
find $targetdir/archive/db -maxdepth 1 -type f -name '*' -mtime +7 -exec rm {} \;
# database dump
mysqldump --opt --no-tablespaces -h$host -u$user -p$password $dbname -r $targetdir/$dbfile
cd $targetdir
tar cvf $backupfile $dbfile
if ! [[ -n "$DB_ONLY" ]]
then
# delete all files older than 90 days(in this case you shouldn't run the complete backup too frequently, e.g. once a month)
find $targetdir/archive/all -maxdepth 1 -type f -name '*' -mtime +90 -exec rm {} \;
cd $projectdir
# files of rootpath(e.g. htaccess, favicon, etc.)
find . -maxdepth 1 -type f -print0 | xargs -0 tar rf $targetdir/$backupfile
# important directories (uploads possibly not necessary)
find fileadmin -type f -print0 | xargs -0 tar rvf $targetdir/$backupfile
find typo3conf -type f -print0 | xargs -0 tar rvf $targetdir/$backupfile
find uploads -type f -print0 | xargs -0 tar rvf $targetdir/$backupfile
fi
backupsize=$(du -h $targetdir/$backupfile | awk '{print $1}')
dbsize=$(du -h $targetdir/$dbfile | awk '{print $1}')
# compress files
cd $targetdir
zip -P $zippw $backupfile.zip $backupfile
if ! [[ -n "$DB_ONLY" ]]
then
backupscope="database and files"
# move to archive
mv $backupfile.zip $targetdir/archive/all/
else
backupscope="database ONLY"
mv $backupfile.zip $targetdir/archive/db/
fi
#clean up
rm $backupfile
rm $dbfile
if ! [[ -n "$NO_MAIL" ]]
then
echo "backup scope: $backupscope" > $mailtext
errno=$(wc -l $errorlog | awk '{print $1}')
echo "number of errors in errorlog: $errno (see below)" >> $mailtext
echo "size of database dump: $dbsize" >> $mailtext
echo "complete size of backup: $backupsize" >> $mailtext
echo "end of backup process: $(date +%F_%T)" >> $mailtext
echo "---------------------------------------------------------------------" >> $mailtext
cat $errorlog >> $mailtext
cat $mailtext | mail -s "Backup: $sitename" $mailreceiver -r$mailsender
rm $mailtext
fi
Do you still have questions or would you like a free consultation? We are happy to be at your disposal as TYPO3 service provider.