[TYPO3-english] Backup script
Vlatko Surlan
vlatkoDOTsurlan at gmail.com
Sun Oct 11 12:13:06 CEST 2009
Damien Sauveron wrote:
> Dear all,
>
> Is someone can share his backup script for typo3 (files, database, etc.)?
Here is a script I use to backup everything relevant on my small dedicated server. Backup is stored on my home machine
accessible via dynamic dns. SSH connection to my home machine is authenticated via keys. Any suggestions on the script
are wellcome.
#!/usr/bin/env bash
LOG_FILE="/var/log/evorion-backup.log"
BACKUP_HOST=david75.dyndns.org
echo "" >> $LOG_FILE
echo "Evorion backup utility started at: `date "+%F %T"`" >> $LOG_FILE
# Must be run as root user
if [ "$UID" -ne "0" ]
then
echo "[`date "+%F %T"`] Error: You must run this script as root!" >> $LOG_FILE
exit 67
fi
echo "[`date "+%F %T"`] User id check succesful" >> $LOG_FILE
# Compress directly into ssh connection
echo "[`date "+%F %T"`] Dumping and archiving started" >> $LOG_FILE
nice -n 19 dpkg -l > /tmp/installed_packages.txt
nice -n 19 mysqldump -u root -ppassword --all-databases | gzip | ssh -q vlatko@$BACKUP_HOST 'cat >
/home/vlatko/abraham_backup/databases_`date "+%F_%T"`.gz'
nice -n 19 tar cz -C / root home/vlatko etc usr/virtualweb | ssh -q vlatko@$BACKUP_HOST 'cat >
/home/vlatko/abraham_backup/archive_`date "+%F_%T"`.tgz'
echo "[`date "+%F %T"`] Dumping and archiving completed" >> $LOG_FILE
# Cleanup
rm /tmp/installed_packages.txt
echo "[`date "+%F %T"`] Finished" >> $LOG_FILE
More information about the TYPO3-english
mailing list