Results 1 to 4 of 4
Hi all,
I have already created a backup scrip that currently is running, however i would like let the task run it repeatedly by overwriting the data for previous week.
...
- 10-25-2010 #1Just Joined!
- Join Date
- Sep 2010
- Posts
- 7
Weekly repeat backup
Hi all,
I have already created a backup scrip that currently is running, however i would like let the task run it repeatedly by overwriting the data for previous week.
Here are the scripts i'm using to run it:
#! /bin/bash
echo Backup Started `date` >> ~/backuplog
mkdir /mnt/usbdrive/backups/`date +%Y%m%d`
tar -czf /mnt/usbdrive/backups/`date +%Y%m%d`/data.tar.gz /data
echo Backup Completed `date` >> ~/backuplog
What are the add in that i need put into so the backup can repeat automatically?
Thanks in advance
- 10-26-2010 #2
You usually would set this up in cron to run this script at set times
- 10-26-2010 #3Just Joined!
- Join Date
- Sep 2010
- Posts
- 7
Yes, i scheduled it using cron
However, i need to make it will overwrite the data weekly so i don't need to delete those files when the HDD is full.
Is there any command i should add in?
- 10-26-2010 #4Just Joined!
- Join Date
- Dec 2009
- Posts
- 1
....overwrite the data weekly so i don't need to delete those files when the HDD is full.
1 option: you can use the 'find' command to look for files older than the curent day, I delete my backup files that are older than 6 days, and execute a 'rm' command.
A quick look at 'man find' will clear things a bit on that one liner.Code:find $backupdir -mtime +6 \( -name "whateveritmaybe" \) -print -exec rm {} \;
You can put that in a script on the weekly cron.


Reply With Quote