** UNTESTED **

#!/bin/sh

# 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