Backup Script



# Remove previous backups to conserve on disk space
rm -f /backups/*

# Apt package list backup
dpkg --get-selections > /backups/dpkg_list_`date +%Y-%m-%d`.txt

# SQL dump
mysqldump -u root -pMYPASSWORD --all-databases > /tmp/mysqlbak
gzip /tmp/mysqlbak
mv /tmp/mysqlbak.gz /backups/dbbackup_`date +%Y-%m-%d`.sql.gz

# Filesystem backup
tar cfj /backups/fsbackup_`date +%Y-%m-%d`.tar.bz2 /etc /var /home

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.