Results 1 to 3 of 3

Thread: Script for backup

  1. #1
    Join Date
    Sep 2012

    Script for backup

    I found some script online i need to use for backup purpose. I have a windows server that transfer daily backup to my ubuntu 12.04 server. Because Windows Server Backup wont save more than one backup at once to a shared folder i have a script that weekly copy and rename(renames with the date) and puts it in another folder. The only problem is that the HDD gets pretty full after some months, so i need a script that deletes every file thats older than 4 weeks, but wont delete any if there isnt any more files added(if the backup stops working).

    Found a script that deletes all files who is older than 3 days: how can i set it to 4 weeks? Or how can i set it to not delete files when its 4 or less folders in my weekly backup folder?

    find /u1/database/prod/arch -type f -mtime +3 -exec rm {} \;


  2. #2
    Join Date
    Feb 2013

    Re: Script, need help.

    Seems like a job for logrotate. Also see savelog.

    Answering your direct question, it seems obvious if you know that 4 weeks make 28 days
    find /u1/database/prod/arch -type f -mtime +28 -delete
    Last edited by schragge; May 3rd, 2013 at 12:55 PM.

  3. #3
    Join Date
    Sep 2012

    Re: Script for backup

    haha, you made me feel stupid now... well part one of the probem is solved! thanks


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts