Wednesday, July 24, 2019

Simple Backup Rotate Script

Simple script to delete backup file which is 7 days older than today within the same Month and Year

#!/bin/bash
# Backup Filename : Backup_$(date +"%d-%m-%Y_%H%M%S").tar.bz2
set $(date +"%m %Y");
# Exec
/usr/bin/find /var/backup -type f -name 'Backup_*-'$1'-'$2'_*.tar.bz2' -mtime +7 -exec rm {} \;
# Logging
echo "Rotating Backup at : $( date +"%d-%m-%Y %H:%M:%S" )" | tee -a /var/log/messages

No comments:

Menghadapi Krisis Dengan Panduan Syariat

﷽ πŸ“— Menghadapi Krisis Dengan Panduan Syariat πŸ‘€ Ustadz Doktor Firanda Andirja حفظه Ψ§Ω„Ω„Ω‡ πŸ“… 18 Juli 2026, 09.00 WIB.  Tabiat dalam kehidupan...