Skip to content

Instantly share code, notes, and snippets.

@qa1
Forked from ssbostan/backup.sh
Created May 5, 2020 11:03
Show Gist options
  • Save qa1/9660daac0674a9b5fbce39cdd20c3198 to your computer and use it in GitHub Desktop.
Save qa1/9660daac0674a9b5fbce39cdd20c3198 to your computer and use it in GitHub Desktop.
Create a backup and Delete old backups
#!/bin/bash
tar -zcf /backups/backup-$(date +%Y%m%d).tar.gz --absolute-names /data
rm -f /backups/backup-$(date -d 'now - 7 days' +%Y%m%d).tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment