How to backup a site using SSH?

Mujkanovic

Well-known member
Collaborate
Registered
Joined
Apr 24, 2016
Messages
424
Points
18
I want to backup all files and databases of an user account into a specify folder via SSH? what commands can I use to do this job?
 

LJSHost

Well-known member
Hosting Provider
Registered
Joined
Jul 5, 2016
Messages
1,031
Points
63
Is this on a cPanel server ? if so /scripts/pkgacct accountname
 

24x7CSM

Well-known member
Registered
Joined
Sep 27, 2016
Messages
263
Points
28
create a tar.gz file of the public_html folder and the database with the command

tar -zcvf tar-archive-name.tar.gz source-folder-name

Once created , download the file to your local machine with either FTP or Secure Shell FTP client.
 

Mujkanovic

Well-known member
Collaborate
Registered
Joined
Apr 24, 2016
Messages
424
Points
18
Is this on a cPanel server ? if so /scripts/pkgacct accountname
I ran this command for a domain, it took long time to generate a zip file and looking like a full backup and pretty weight for the zip file.

It is a full backup and I can use to restore from cPanel control panel?

Code:
[root@server ~]# /scripts/pkgacct mydomain
[2017-04-17 02:40:58 +0000] pkgacct started.
[2017-04-17 02:40:58 +0000] pkgacct version 10 - user : mydomain - tarball                                                         : 1 - target mysql : default - split: 0 - incremental: 0 - homedir: 1 - mailman:                                                          1 - backup: 0 - archive version: 3 - running with uid 0
[2017-04-17 02:40:58 +0000] pkgacct using '/usr/local/cpanel/3rdparty/bin/pigz -                                                         6 --processes 1 --blocksize 4096 --rsyncable' to compress archives
[2017-04-17 02:40:58 +0000] pkgacct working dir : /home/cpmove-mydomain
[2017-04-17 02:40:58 +0000] Copying Reseller Config...[2017-04-17 02:40:58 +0000                                                         ] Done
[2017-04-17 02:40:58 +0000] Copying Suspension Info (if needed)...[2017-04-17 02                                                         :40:58 +0000] Done
[2017-04-17 02:40:58 +0000] Copying SSL certificates, CSRs, and keys...[2017-04-                                                         17 02:40:58 +0000] Done
[2017-04-17 02:40:58 +0000] Storing SSL domain......[2017-04-17 02:40:58 +0000]                                                          Done
[2017-04-17 02:40:58 +0000] Copying Domain Keys....[2017-04-17 02:40:58 +0000] D                                                         one
[2017-04-17 02:40:58 +0000] Copying Counter Data....[2017-04-17 02:40:58 +0000]                                                          Done
[2017-04-17 02:40:58 +0000] Copying Bandwidth Data....Summary databases … done!
[2017-04-17 02:40:59 +0000] Done
[2017-04-17 02:40:59 +0000] Copying Dns Zones.......mydomain.com...[2017-0                                                         4-17 02:40:59 +0000] Done
[2017-04-17 02:40:59 +0000] Copying Mail files....[2017-04-17 02:40:59 +0000] Do                                                         ne
[2017-04-17 02:40:59 +0000] Copying proftpd file....[2017-04-17 02:40:59 +0000]                                                          Done
[2017-04-17 02:40:59 +0000] Copying www logs.......log file sizes [4175964 byte(                                                         s)]......mydomain.com......mydomain.com-bytes_log......ftp.mydomain                                                         tours.com-ftp_log.offsetftpbytes...[2017-04-17 02:40:59 +0000] Done
[2017-04-17 02:40:59 +0000] Copy userdata...[2017-04-17 02:40:59 +0000] Done
[2017-04-17 02:40:59 +0000] Copy custom virtualhost templates...[2017-04-17 02:4                                                         0:59 +0000] Done
[2017-04-17 02:40:59 +0000] Copying mailman lists and archives....[2017-04-17 02                                                         :40:59 +0000] Done copying mailman lists and archives.
[2017-04-17 02:40:59 +0000] Copying homedir.............
[2017-04-17 02:41:00 +0000] Done
[2017-04-17 02:41:00 +0000] Calculating nobody files............
[2017-04-17 02:41:00 +0000] Done
[2017-04-17 02:41:00 +0000] Performing Postgresql” component....
[2017-04-17 02:41:00 +0000] Completed Postgresql” component.
[2017-04-17 02:41:00 +0000] Performing Mysql” component....
[2017-04-17 02:41:00 +0000] Determining mysql dbs...[2017-04-17 02:41:00 +0000]                                                          ...mysqldump version: 10.1.22...[2017-04-17 02:41:00 +0000] ...mysql version: 10                                                         .1...[2017-04-17 02:41:00 +0000] Saving mysql privs...[2017-04-17 02:41:00 +0000                                                         ] Done
[2017-04-17 02:41:01 +0000] ...Done
[2017-04-17 02:41:01 +0000] Storing mysql dbs............
mydomain_dbgonmar[2017-04-17 02:41:01 +0000] (19411209 bytes)
mydomain_bloggmmt[2017-04-17 02:41:01 +0000] (2272836 bytes)
roundcube.users,roundcube.identities,roundcube.contacts,roundcube.contactgroups[                                                         2017-04-17 02:41:01 +0000] (6874 bytes)
roundcube.contactgroupmembers[2017-04-17 02:41:01 +0000] (2423 bytes)
[2017-04-17 02:41:01 +0000] ...Done
[2017-04-17 02:41:01 +0000] Completed Mysql” component.
[2017-04-17 02:41:01 +0000] Copying cpuser file.......[2017-04-17 02:41:01 +0000                                                         ] Done
[2017-04-17 02:41:01 +0000] Copying crontab file.......[2017-04-17 02:41:01 +000                                                         0] Done
[2017-04-17 02:41:01 +0000] Performing Quota” component....
[2017-04-17 02:41:01 +0000] Completed Quota” component.
[2017-04-17 02:41:01 +0000] Performing Integration” component....
[2017-04-17 02:41:01 +0000] Completed Integration” component.
[2017-04-17 02:41:01 +0000] Performing AuthnLinks” component....
[2017-04-17 02:41:01 +0000] Completed AuthnLinks” component.
[2017-04-17 02:41:01 +0000] Performing APITokens” component....
[2017-04-17 02:41:01 +0000] Completed APITokens” component.
[2017-04-17 02:41:01 +0000] Storing Subdomains....
[2017-04-17 02:41:01 +0000] Done
[2017-04-17 02:41:01 +0000] Storing Parked Domains....
[2017-04-17 02:41:01 +0000] Done
[2017-04-17 02:41:01 +0000] Storing Addon Domains....
[2017-04-17 02:41:01 +0000] Copying password.......[2017-04-17 02:41:01 +0000] D                                                         one
[2017-04-17 02:41:01 +0000] Copying shell.......[2017-04-17 02:41:01 +0000] Done
[2017-04-17 02:41:01 +0000] Creating Archive ...................................                                                         .................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
..................................................
[2017-04-17 02:48:42 +0000] Done
[2017-04-17 02:48:42 +0000] pkgacctfile is: /home/cpmove-mydomain.tar.gz
[2017-04-17 02:49:07 +0000] md5sum is: eda338240f558d508b2953967dc458b9
[2017-04-17 02:49:07 +0000]
[2017-04-17 02:49:07 +0000] size is: 5405972920
[2017-04-17 02:49:07 +0000]
[2017-04-17 02:49:07 +0000] homesize is: 5808152576
[2017-04-17 02:49:07 +0000]
[2017-04-17 02:49:07 +0000] homefiles is: 59210
[2017-04-17 02:49:07 +0000] pkgacct completed
create a tar.gz file of the public_html folder and the database with the command

tar -zcvf tar-archive-name.tar.gz source-folder-name

Once created , download the file to your local machine with either FTP or Secure Shell FTP client.
I knew this way but what about mysql databases?

they should be downloaded from phpmyadmin?
 

LJSHost

Well-known member
Hosting Provider
Registered
Joined
Jul 5, 2016
Messages
1,031
Points
63
Yes this is a full account backup which can be used to restore the account including the databases as you can see from the log,

No @24x7csm example will only archive the public_html without databases or emails, yes you would need to use phpmyadmin to export the database if using this manual method.
 

SvenHost

Active member
Hosting Provider
Registered
Joined
Apr 18, 2017
Messages
65
Points
8
I want to backup all files and databases of an user account into a specify folder via SSH? what commands can I use to do this job?
This is the perfect method to take full cPanel account backup it includes databases as well.
 

iserveradmin11

Member
Registered
Joined
Mar 17, 2017
Messages
60
Points
8
Hello,
There could be various method for backups .
Make tar of your public_html file and take back up of database and then can send these file to desired location (server) through scp or download the backed-up files through FTP .
 
Latest Threads
Recommended Threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top