Server backup

aquila

Verified User
Joined
Jul 2, 2007
Messages
63
Hello,

Our system backup drive gets full every week. I have to manually delete previous backups. Is it possible to automate this? I mean, I just want the backups for one week, so when a new backup is created, i would like to have DA delete anything older than a week.

I see that it is possible with the reseller/user backups. But is it also possible for the SYSTEM BACKUP?

Cheers
 
We ftp all backups to a separate server. We do rotation as often as we need, using a cronjob on the backup server.

for example:
Code:
# rm -Rf old_backup
# mv current_backup old_backup
# mkdir current_backup
Note the above is over-simplified, but should give you some useful ideas.

Jeff
 
So from what i have understood, we have to get this done manually and not through DA. Is it possible to take my request as a "Feature request" and get this feature on the DA's server backup page? So, administrators are given an option to store only backups for a particular period of time (eg, a week) and delete old backups when DA starts creating a new backup.

Thank you for your quick response though. DA is great!
 
Run in a crontab:

/path/to/file.sh | /usr/bin/mail -s 'Backup Cleaner' [email protected]

However if you already receive emails from the cron daemon then you dont have to pipe it to the mail command to receive the email.

You would just put it in a crontab as

/path/to/file.sh

Code:
#!/bin/sh

backup_directory="/backup/system" # No trailing /
backup_time="2" # Remove backups how many days old? Number variable only!

#### Commands ####

find_files=`find $backup_directory -maxdepth +1 -mtime +$backup_time`

#### Begin Script ####

ver="Directory cleaner and backup v1.0 by Andrew ([email protected])"

##

echo "
Backup File Cleaner
"
echo ""
echo "Looking for old backups... Older then $backup_time days old."
echo "----"
if [ -z "$find_files" ]; then                 
echo "None Found!"
else
echo "$find_files"
fi
echo "----"
echo ""
echo "If any folders were found they have deleted."
find $backup_directory -mtime +$backup_time -delete
echo ""
echo "Done."
echo ""
echo "Thanks for using $ver."
echo ""
 
Last edited:
I could never get that solution to work.

Here's mine:

Create a crontab with this code (probably need to be root):

Code:
find /backup -mtime +7 -type d -depth -exec rm -r {} \;

where "/backup" is the directory the backups are in and "7" is the number of days to keep the backups before they're deleted.
 
I could never get that solution to work.

Here's mine:

Create a crontab with this code (probably need to be root):

Code:
find /backup -mtime +7 -type d -depth -exec rm -r {} \;

where "/backup" is the directory the backups are in and "7" is the number of days to keep the backups before they're deleted.

Looks nice, thanks. I had to make some modifications to chatwizrd's script to make it work on my centos. I'm currently using it and its good.
 
Back
Top