LOGFILE=/home/backup/logs/domainbackup_$(date +'%Y%m%d_%H%M').log
FILE=domainbackup_$(date +'%Y%m%d_%H%M').tar
DATE=$(date +'%Y%m%d_%H%M')
cd /home/httpd/vhosts/
echo "*** Creating Single-Backups ***" >> $LOGFILE
for file in $( ls -xA1d * ); do
if [ -d ${file} ]
then
du $file --max-depth=0 >> $LOGFILE
echo "Saving " $file
tar -czf $file.tar.gz $file >>$LOGFILE
fi
done
cd /var/lib/mysql
for database in $( ls -xA1d *); do
if [ -d ${database} ]
then
du $database --max-depth=0 >> $LOGFILE
echo "Dumping databases " $database
mysqldump -uadmin -p*** $database > $database.sql
tar -czf $database.sql.tar.gz $database.sql >>$LOGFILE
fi
done