August 29, 2015

Backup all cpanel accounts

UPDATE: The one-liner below still works as of 7/23/15 on CENTOS 5.8 x86_64 WHM 11.50.0 (build 27). Will be testing shortly on CENT7
To create all accounts backup on your server, execute following command
 for backup in `\ls /var/cpanel/users/`; do echo /scripts/pkgacct $backup; done
Run it the first time to see what it is going to do and then run it a second time and remove the echo command from it
 for backup in `\ls /var/cpanel/users/`; do /scripts/pkgacct $backup; done
again you will find all accounts backed up under /home named cpmove-cpaneluser*.tar.gz
SCP Backups to New Server
After creating backup you have to transfer all accounts backup to your new server i.e Server B using SCP.
scp cpmove-* root@172.120.0.1:/home
Be sure all backups should move to /home directory of new server.
If you have done all accounts backup then you should have to move /var/cpanel/users file for restore on new server i.e Server B in /home directory with name user.txt
scp /var/cpanel/users root@172.120.0.1:/home/user.txt
Restore Backup
To restore single account backup execute following command.
/scripts/restorepkg cpaneluser
where cpaneluser is of old server and can be found on backup filename after cpmove. i.e
cpmove-cpaneluser*.tar.gz
To restore all accounts
for restore in `\cat /home/user.txt`; do echo /scripts/restorepkg $restore; done
Now you can List Account in WHM to see all accounts are transferred successfully to your new server and you can login to cpanel accounts of user using same Cpanel user / pass as old server.
Also for all accounts;
[root@host.mydomain.com] >> /scripts/cpbackup 
[cpbackup] Process started in background.
[cpbackup] Log file: /usr/local/cpanel/logs/cpbackup/1286038243.log
Share This!

Related Posts:

  • Hướng dẫn fix lỗi Data Error khi truy cập File Manager trong cpanel Đã bao giờ bạn truy cập File Manager trong cpanel để quản lý file,nhưng bạn không thấy bất kỳ 1 file nào ngoài thông báo  “Data Error” ?Lỗi không hiển thị file trong  File Manager như trên vì lý do nào đó,bạn … Read More
  • Hướng dẫn tăng tốc website bằng tính năng nén trên cPanelĐây là bài viết hướng dẫn tăng tốc độ load website, một tính năng có sẵn trên cPanel. Với việc website được nén lại sẽ nhẹ hơn, load nhanh hơn, giúp tối ưu hóa website tốt hơn trên bộ máy tìm kiếm.Bước 01: Bạn cần đ… Read More
  • Hướng dẫn sử dụng easyapache thông qua command line 1. Giới thiệu:Công cụ easyapache cho phép cài đặt, điều chỉnh, thiết lập các thành phần của PHP và Apache cho WHM và cPanel.Khách hàng có thể sử dụng công cụ này thông qua giao diện hoặc command line. Khi sử dụng phiên … Read More
  • NHỮNG LỆNH COMMAND HỮU ÍCH TRÊN CPANEL/WHM Bên dưới đây là các lệnh command tự động sửa lỗi hệ thống rất hữu dụng. Giả sử như các thao tác trên SSH có lỗi nào đó xảy ra, thì các command bên dưới sẽ sửa được các lỗi đó. Thay yourdomain.com thành tên miền của bạn, khi … Read More
  • Backup all cpanel accounts UPDATE: The one-liner below still works as of 7/23/15 on CENTOS 5.8 x86_64 WHM 11.50.0 (build 27). Will be testing shortly on CENT7 To create all accounts backup on your server, execute following command  for backup … Read More

0 comments:

Post a Comment