(run as sudo)
- local backup
rsync -azvv --exclude /var/log /etc /home /opt /var /pathtofolderwherebackupisstored
- remote backup
rsync -azvv -e ssh /foldertobackup remoteuser@remotehost.remotedomain:/wheretostorebackup https://help.ubuntu.com/community/rsync to backup mysql database, it is enough to: - stop mysql server <code>/etc/init.d/mysql stop
- backup the contents of the /var/lib/mysql folder
rsync -azvv /var/lib/mysql /somewhere
- backup the database(s)
mysqldump -u root -ptmppassword --all-databases > /tmp/all-database.sql
source here
(as sudo) run crontab:
crontab -e
edit the file, so that cronjob will run the command each 1st of the month, at 20:45
45 20 1 * * rsync -azvv --exclude /var/log /etc /home /opt /var /srv/mis_duplicate/backingup
and backup the server (only folders /etc, /home, /opt, /var) to an external disk
cron format: http://www.nncron.ru/help/EN/working/cron-format.htm
more:
http://rbgeek.wordpress.com/2012/05/22/automatic-backup-from-ubuntu-server-with-rsync/