This setup creates a full backup of your cPanel account each month, maintaining one backup for each previous year, and monthly backups for the current year. Backups are stored on another host.
You need two files:
- crontab.txt (for setting up the cron job, that is, to make everything work automatically)
- full_backup.sh (the actual backup script)
I had to store these files on the host that I wanted to back up. You may be able to put them elsewhere. Make sure you have curl enabled where you put the script.
crontab.txt
MAILTO="webmaster@example.com" 5 4 28 * * /home/yourdomain/full_backup.sh 5 4 31 12 * /home/yourdomain/full_backup.sh --year
You'll have to set your crontab with a command like:
crontab crontab.txt
You can see what's in your crontab with the following command:
crontab -l
full_backup.sh
Put the file, say, in your account root and make the file executable (e.g. with command "chmod 700 full_backup.sh").
Let me know in the comments how it works for you. Thanks!
4 Comments
I was playing around with this and really liked it. I used the 1.1 version but wanted to go with the 1.2 version due to being able to put files into directories. The thing is the 1.2 version fails for me. If I cut and paste the "https://xxxxxxx.com:2083/frontend/x3/backup/dofullbackup.html" into a browser it runs fine. Any ideas?
/home/xxxxxx/backup/cpanel_backup.sh: line 51: https://xxxxxxx.com:2083/frontend/x3/backup/dofullbackup.html: No such file or directory
curl returned exit status 127 - see curl manual pages for more details
root@www1 [~]# curl: (6) Couldn't resolve host '–silent'
curl: (6) Couldn't resolve host '–insecure'
curl: (6) Couldn't resolve host '–user'
curl: (6) Couldn't resolve host 'username:password'
I encountered the same problem as matt posted on 10-Sep-08. I am using a free shared hosting account to host a school PTA website. Has anyone else seen this, or better yet, has anyone found a way to get this to work ?
Thanks.
I compared the version 1.1 script to the version 1.2 script, and it looks like the some of the arguments to the "curl" command require 2 dashes instead of a single dash. I gave up on this script because I didn't have a lot of time to debug it. I found a different version of the same script that works, even with SCP. Give it a try: http://downloads.tech-pro.net/script-to-automate-cpanel-full-backup_f-cpbackup.html
Even though it doesn't specify SCP support in the README file, you can put "scp" in the $ftpmode variable, and it works. The code is a bit cleaner, since the author separated the variables into 1 file, and the actual backup script into another file.
I talked earlier with Matt. We couldn't resolve the problem but I think I've now found the reason. Must've been some WordPress magic.. the code has double dashes when I post it but it appears as one long dash. Similar problem with quotes. I've updated the post.
Btw, thanks, anonymous, for posting a link to an (another 😉 ) working solution!
2 Trackbacks/Pingbacks
[...] Room Simple Solutions and Other Oxymorons Skip to content HomeAboutAutomatic cPanel Backup via Curl & CronWP: Blog [...]
[...] (à lire en anglais) à ce script existe si vous avez plusieurs sites à sauvegarder ainsi qu’une autre adaptation avec un fichier “full_backup.sh” (à lire en [...]