|
File Maintenance in a shell script?
I have a main server and a backup server. I back up my main server every night and push the backup file to the backup server with ncftpput. I do this through cron, and it works fine.
On the backup server, I'd like to implement some sort of automatic file maintenance, to keep only the files I want, but I don't know enough shell scripting to tackle this correctly. I'd appreciate any help you could give.
Here's what I want to do:
Every night, run these rules in my backup directory: If a backup file is less than 2 weeks old, don't touch it. If files are more than 2 weeks old, delete the backup file unless it was made on a Friday (so I can archive a weekly backup) or the last day of the month (so I can archive a monthly backup).
Can this be easily done?
Thanks,
-Mark
|