Shell Script for Set Schedule Delete Directory Server Backup

Dear,
I have one problem regarding using linux suse, could you please help with below description
- I want to using shell script for delete directory that had in server backup linux:
 
I have a lot of server but has one server that function as backup server(backup only mysql). Now my server backup has backup everyday from Monday to Saturday from 1st to 30th. So it make my server backup has a lot of folder. Example, Server backup has backup mysql from other server as below serverbackup backup in (/home/backup/serverA, serverB, ServerC.......) But in each server has many folder from monday to saturday and from 1st to 30th and year. So it make my serverbackup heavy because it has much folder. in folder serverA/27102009, 28102009, 29102009.....has more that 30. But i want to set up on script that can delete it all this folder but keep only one last week.  we can set delete it every saturday night...but i don't know at all with using script. I hope all above issue should be clear and can advice me or give me an idea or example.
 
Dear KhmerOs, i hope everyone fine because i used to know all of you for two month with my internship but now i had work that base on linux just start for three week ago. But i face some problem as above.
Please kindly advice. Especially teacher Eng, you are specialist on this linux i hope i can get an idea from you soon.
 
Kind Regards,
Chamreth
 
 
 
 
 
 

Hi

Hi Chamreth,
 
I'm not an expert here, but do you know how to write shell script to delete those folders?
If you do, all you need to to create a cron job to execute that script at a given time.
 
 

NakIf it is not POSIX it is CRAP.

hi

Dear,
 
I didn't know much about using shell script. But i can know only simple comment that can delete folder like rm -r foldername but for script i really don't know at all because it need us to think which folder need to delete because we want to keep only one week. If you could help me more idea may be good. THanks any way for your reply back to me.
 
Hope to hear from other soon.
 
 
Regards,
Chamreth

evannak's picture

Hi Chamreth,   I think

Hi Chamreth,
 
I think creating a cronjob is better. but fist I suggest you testing it before practice it. you can check this http://www.adminschoice.com/docs/crontab.htm for more infor.
 
Cheers,
Vannak
 

---------------------------------------------
http://ikhmer.info Connecting Cambodians...

Syndicate content