LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   File Maintenance in a shell script? (https://www.linuxquestions.org/questions/linux-general-1/file-maintenance-in-a-shell-script-46362/)

mdscudder 02-20-2003 02:29 PM

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

Tinkster 02-20-2003 05:14 PM

You might want to give rsync a closer look, and in
particular play with the script at the top of this page
It doesn't quite do what you want but might give
you ideas on how to work it ;)

Cheers,
Tink


All times are GMT -5. The time now is 03:32 PM.