Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 02-20-2003, 02:29 PM   #1
LQ Newbie
Registered: Mar 2002
Location: Johnson City, NY
Distribution: Slackware 8
Posts: 9

Rep: Reputation: 0
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?

Old 02-20-2003, 05:14 PM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911Reputation: 911
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 ;)



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Shell] Read a File from script yussef Programming 4 08-19-2008 04:26 AM
cannot execute script file from shell shahrahulb Linux - General 4 03-04-2008 07:02 AM
shell script: File Manipulation simon_qwl Programming 2 10-29-2005 03:40 PM
file renaming with shell script or ? XJNick Linux - General 5 07-29-2005 02:43 PM
File Parsing using a Shell Script yasir15 Programming 5 08-22-2003 12:17 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration