944,017 Members | Top Members by Rank

Ad:
Oct 27th, 2009
0

Cut off every 7 days

Expand Post »
Hi,

I am a trainee System Administrator in my company and still a newbie. How do I set the cron job to only show the current week's backup (in the database backup directory) and remove the previous week's backups.

One week would mean Monday to Saturday.

Pls help.

Tqs.
Last edited by Aigini; Oct 27th, 2009 at 3:35 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
Aigini is offline Offline
25 posts
since Jun 2008
Oct 27th, 2009
0
Re: Cut off every 7 days
Click to Expand / Collapse  Quote originally posted by Aigini ...
Hi,

I am a trainee System Administrator in my company and still a newbie. How do I set the cron job to only show the current week's backup (in the database backup directory) and remove the previous week's backups.

One week would mean Monday to Saturday.

Pls help.

Tqs.
Hi

First create a script like (removeoldbackup.sh) in that script add these lines.

#!/bin/sh
cd /database_backup_directory/
find . -mtime +7 -exec rm -rf {} \;

exit and save file. Then make that file executable. I hope you know about how to make executable.

Then you can set crontab as per your requirement.


That is...
Reputation Points: 10
Solved Threads: 1
Newbie Poster
i_tears is offline Offline
12 posts
since Oct 2009
Oct 27th, 2009
0
Re: Cut off every 7 days
Where do I put that script? Should it also be in the same directory as the backup script?
Reputation Points: 10
Solved Threads: 0
Light Poster
Aigini is offline Offline
25 posts
since Jun 2008
Oct 27th, 2009
0
Re: Cut off every 7 days
Click to Expand / Collapse  Quote originally posted by Aigini ...
Where do I put that script? Should it also be in the same directory as the backup script?
Its your choice place it anywhere like. /home/scripts/databasebackupscripts.sh

Regards
Reputation Points: 10
Solved Threads: 1
Newbie Poster
i_tears is offline Offline
12 posts
since Oct 2009
Dec 8th, 2009
0
Re: Cut off every 7 days
Oh no! You're unqualified for your job, which is basically googling technician. Quick, post "How I sysadmin a com-pu-tar!?!?" to a forum until someone gives you the answer!
Reputation Points: 115
Solved Threads: 5
Junior Poster
Toba is offline Offline
192 posts
since Jun 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Linux Applications and Software Forum Timeline: Problem Using the SQL Developer in Ubuntu
Next Thread in Linux Applications and Software Forum Timeline: mail server using fedora help please





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC