Backups

Storm3y

New Member
Hi,

I'm looking to backup each cPanel accounts home directory and MySQL databases every day to a remote FTP server (GoDaddy). I know cPanel has a built in feature to do this but it currently doesn't delete backups after a period of time.

I would like to keep 7 days worth of backups for each account. Any idea what the best solution would be?


Thanks
 
Does the other account give you access to a crontab (assuming it's Linux)?

If so, you could write a quick cron to delete files older than 7 days, then use cPanel's built in backup feature.
 
I have a cPanel account on the server with crontabs ability for cron tabs. I have also noticed that the cPanel backups aren't time / date stamped so they get overwritten every night.
 
You could add a cron with code similar to this.

Code:
find /backup/ -mtime +7 -exec rm '{}' \;

This will delete files older than 7 days in the given folder "/backup".
 
This would go in the crontab of the remote server. FTP backups would be enabled normally.

You'd need to change /backup to the proper location of the backup storage.
 
Ah the remote server is just a FTP server from GoDaddy. Would it be possible to run that crontab on my VPS with you guys?
 
In theory, sure, but there won't be much of a clean way to keep the password secure as it would be plainly visible in the crontab.
 
Hi Storm3y,

You'd need something with a bit more flexibility than a standard FTP server in order to be able to do this unless the FTP server also support SSH. You could give the backup files the same names on a rotating schedule if whatever you're using to do backups supported it, WHM backups wouldn't as you can't enter custom names there.

Have you considered using Amazon's S3? I wrote a script that is in the tutorial section here for it that wouldn't be too difficult to modify.
 
Hi Dan,

Amazon S3 would be good however it is just too expensive for what we want. We have GoDaddy online storage which costs $24.99 per year however it only has FTP and not SFTP.

We had a cronjob setup on our old VPS however I have lost it.
 
You need a cronjob to copy the file, and then delete the file also via FTP based on date. This could be put in a cron run from your VPS.

I'll see if I can't come up with a cronjob to do this for you in the morning.
 
Top