A simple backup script using logrotate to save multiple backups.
I use a NFS storage mounted via autofs as backup location.
Database Backup is optional.
#!/bin/bash # Backup Target (Network Share mostly via autofs) BACKUP_DIR="/tmp/foo" # Number of Backups BACKUP_NUM=3 # Directories to backup SOURCE_DIRS="/var/www /var/log /etc" # Backup savelog -n -l -q -c $BACKUP_NUM "$BACKUP_DIR/fileBackup.tar" tar cf "$BACKUP_DIR/fileBackup.tar" $SOURCE_DIRS # Optional Database Backup savelog -n -l -q -c $BACKUP_NUM "$BACKUP_DIR/mysql.sql" mysqldump -u root -pYOURPASSWORD --all-databases > "$BACKUP_DIR/mysql.sql"