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:

Sebab-sebab Hati Berpenyakit

 ﷽ 📘 Kitab Al-Bahrur Raa’iq fi Az-Zuhd war-Raqaa’iq karya Syaikh Dr. Ahmad Farid Ustadz Ahmad Bazher hafizhahullahu ta’ala  🗓️ Sabtu Pagi,...