Skip to main content
pivica.me
Site about Drupal, Web Development, and other stuff...
  • Home
  • Blog
  • Projects
  • Drupal cheat sheets
  • About me
  • Contact
  1. Home
  2. Blog
  3. Remote FTP backups of your WHM/CPanel accounts

Remote FTP backups of your WHM/CPanel accounts

  • Log in to post comments

So WHM/CPanel has already a very nice build in solution for doing automated local or FTP/SFTP remote backups of your accounts or accounts with all machine configuration files. The only problem is that you can use one of this backup - local or remote, you can not use both. And I wanted to do both stuff - first local backups and then remote FTP backups. Its not that difficulty at all. First thing to do is make sure you configured correctly daily, weekly, monthly backups for local backups in your WHM. If that works then you can add remote FTP backups. For this you will need a shell script that is copying your local baclup files and you need to configure cron then that will execute this script.

An example of daily backup script that is copying all accounts from local daily backup folder (/backup/cpbackup/daily/) to remote ftp folder (/cpbackup/daily)

$ more /root/bin/ftpbackup_daily
#!/bin/sh
ftp -n << EOF
open <ip/domain of your ftp remote server>
user <username> <password>
bin
hash
prompt
cd /cpbackup/daily
lcd /backup/cpbackup/daily/
mput *.tar.gz
bye
EOF

And I have similar scripts for weekly and monthly backups - it just copy daily backup folder to remote weekly and monthly ftp folders. Before configuring cron you need to change permissions of backup script so it can be executed.

$ chmod 700 /root/bin/ftpbackup_daily

And now cron configuration

$ crontab -e
0 1 * * 3,5,0 /root/bin/ftpbackup_daily > /root/bin/ftpbackup_daily.log
0 2 * * 0 /root/bin/ftpbackup_weekly > /root/bin/ftpbackup_weekly.log
0 3 1 * * /root/bin/ftpbackup_monthly > /root/bin/ftpbackup_monthly.log

So this means that cron will do daily backup copies in 01:00AM every Wednesday, Friday and Sunday (because WHM will do backups on Tuesday, Thursday and Saturday). Weekly backups will be done each Sunday in 02:00 AM and finally monthly backups will be done first day every month in 03:00AM.

For cron syntax and cron command generator you can use http://cron.nmonitoring.com/cron-generator.html or just consult cron manual.

Comments

Automated Incremental Backups

Submitted by Sukalyan Das (not verified) on 24 January 2013
Permalink

Hii,

I went through the following sites recently

www.failsafe.us
www.backupmachine.com

They offer daily incremental backups. The amazing feature of Failsafe being offered by Failsafe.us infact automatically undoes any unauthorized modifications done on a website.

Hope this will help out a few people.

  • Log in to post comments
Submitted on 24 June 2012

Tags

Linux
CPanel
WHM

Related blogs

Backup folders in Linux over rsync to Freenas disk

18 May 2012

Reinstalling erased boot partition on linux

02 April 2012

500 internal server error while uploading files bigger then 100kb - mod_fcgid problem

08 July 2011

© Copyright 2025 by Ivica

  • Instagram
  • Twitter
To top