Re: Bash script for backup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



From: Alan Hoffmeister <alangtk@xxxxxxxxx>
> I need a script that will backup & compress the folder /media/system in 
> the folder /media/backups
> But that's not the problem, I need that only the last 7 backups (last 7 
> days, yeah I know, cronjob...) will stay in that folder...
> The script need:
> 1 - Compress folder /media/system
> 2 - Store in /media/backups
> 3 - Name the compressed backup like day_month_year.tar.gzip
> 4 - Check the other backups and delete backups older than 7 days..

Either name the backups backup.`date +"%u"`.
The old files will automaticaly be overwritten by the new ones...
Or just after the backup, do something like (untested):
  find /media/backups -ctime +7 -delete

JD


      
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux