0

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.

Edited by Aigini: n/a

3
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by Toba
0

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...

0

Where do I put that script? Should it also be in the same directory as the backup script?

0

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!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.