The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Backup Question

Discussion in 'Data Protection' started by cerdovolador, Apr 30, 2010.

  1. cerdovolador

    cerdovolador Registered

    Joined:
    Apr 30, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Hi, I wonder how can I backup an account via ssh, I know the script is /scripts/cpbackup but what I want is to select the users to backup.

    I know how to do it via cpanel, (just mark or unmark the users) but how can I do this by script? It's a little bit annoying having to deselect every account every time I want to backup an account.
     
  2. cPanelJared

    cPanelJared Technical Analyst
    Staff Member

    Joined:
    Feb 25, 2010
    Messages:
    1,842
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Use pkgacct

    To make a backup of only a single account, use the pkgacct script. The syntax is:

    Code:
    # /scripts/pkgacct $account
    where $account is replaced with the actual account name. A package will be made containing all the data needed to restore the account, and the location of the package file will be displayed at the end of the process.
     
  3. cerdovolador

    cerdovolador Registered

    Joined:
    Apr 30, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Thank you for your quick reply.

    By the way, I get a message that says:

    # warn [pkgacct] Missing user argument
    Unable to get user id for user at /scripts/pkgacct line 123.

    Did I forget any parameter?

    I typed: /scripts/pkgacct $User_account_name


    Another question, This would backup the web only?
     
    #3 cerdovolador, Apr 30, 2010
    Last edited: Apr 30, 2010
  4. cPanelJared

    cPanelJared Technical Analyst
    Staff Member

    Joined:
    Feb 25, 2010
    Messages:
    1,842
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    From what you describe, it sounds like you literally typed "/scripts/pkgacct $User_account_name ", based on the message "Unable to get user id for user." In my example, "$account" was meant to be replaced by the actual cPanel account username. For example, if I had an account with the username "foo", I would use the following command to package it:

    Code:
    # /scripts/pkgacct foo
    A word with a dollar sign ($) in front of it is widely interpreted to be a variable that should be replaced with another word when you actually run the command. This is what I intended with my "/scripts/pkgacct $account" example. I noted that this was valid "where $account is replaced with the actual account name."

    The syntax as given is correct. Type /scripts/pkgacct followed by the actual cPanel account username. I apologize for the confusion that may have been caused by the user of the variable notation.
     
  5. cerdovolador

    cerdovolador Registered

    Joined:
    Apr 30, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    The problem is that I think this script /scripts/pkgacct just backup the homedir, am I wrong? I'd like to make a full backup, I mean homedir directory, and mysql backups, and any other files that would backup the: /scripts/cpbackup, but selecting what account to backup.

    Anybody know the answer?
     
  6. cPanelJared

    cPanelJared Technical Analyst
    Staff Member

    Joined:
    Feb 25, 2010
    Messages:
    1,842
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    pkgacct packages the entire account

    /scripts/pkgacct packages everything needed to restore the account in its current state. This includes the home directory, database(s), DNS zone(s), users file, and other data. pkgacct packages all of this into a .tar.gz archive.

    The .tar.gz archive can then be restored using /scripts/restorepkg. An account can be completely deleted from the server, and restored fully using the .tar.gz archive created by pkgacct.

    You can see for yourself what is included in the package created by running /scripts/pkgacct on an account. You can then expand the archive to see everything that was put into the archive:

    Code:
    # /scripts/pkgacct youraccount
    # mkdir atmpdir
    # cd atmpdir
    # tar zxvf /home/cpmove-youraccount.tar.gz
    # cd youraccount
    # ls -alh
    /scripts/pkgacct creates the archive with the filename "cpmove-youraccount.tar.gz", where "youraccount" is the actual cPanel account name. It will not be "your account"; it will be the actual account name, but it will have "cpmove-" in front of it and ".tar.gz" after it. Normally, the cpmove file is written to /home. To restore an account package using /scripts/restorepkg, place it in /home or /root.
     
  7. cerdovolador

    cerdovolador Registered

    Joined:
    Apr 30, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Ok, thanks for all, You solved all my questions.
     
Loading...

Share This Page