• The template for this display is not available. Please contact a Site administrator.

Simple linux backup script

So I thought I would share (for those techie folks) the backup script I use for the site.  It also backups up some other sites and mysql tables.

It's by no means a "good" script but it does function for my needs

I put this script into the following directory so it will run daily.



Here is the backup script


#Set Date
today=$(date +%Y%m%d)
#Delete old Backups
find /mnt/backup/sitebackups* -mtime +1 -exec rm {} \;
echo Delete old backups complete
#Backup Databases
mysqldump -u root -p"Password" "Database" > /tmp/"Database"$today.sql
echo frv done
mysqldump -u root -p"Password" "Database"> /tmp/"Database"$today.sql
echo madhatt done
mysqldump -u root -p"Password" "Database"> /tmp/"Database"$today.sql
echo madjoom done
mysqldump -u root -p"Password" "Database" > /tmp/"Database"$today.sql
echo tpforum done
mysqldump -u root -p"Password" "Database" > /tmp/"Database"$today.sql
echo tpwp done
echo mysql dump done
sudo tar -cvf /mnt/backup/mysqlbackups/$today.tar /tmp/*.sql
echo mysql tar done
sudo rm /tmp/*.sql
echo mysql tmp delete done
#Compress websites
sudo tar -cf /mnt/backup/sitebackups/backup$today.tar /var/www/*