Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Jan 2012
    Posts
    3
    cPanel/Enkompass Access Level

    Root Administrator

    Question Fully explain /scripts/restorepkg

    Hi. Just wonder if anyone knows the full explanation and effects of the /scripts/restorepkg command. I have found this: /http://www.webhostinghero.ca/how-to-back-up-and-restore-accounts-via-command-line.html

    But I need more information and want to fully understand what I am using:

    restorepkg [--force] [--skipres] [--override] [--ip=(y|n|Custom IP)] -- [cpuser|/path/to/cpuser-file]

    In particular:
    In using "--force" to overwrite accounts, does it mean the original account is terminated (totally removed) and recreated again? Or it just means overwriting files (so old and new files live together)? Or just remove and recreate databases or what???

    What is the use of "--override"?

    Any ideas or pointers to full explanation will be highly useful. Thanks.

  2. #2
    cPanel Staff
    Join Date
    Dec 2010
    Location
    ¯\_(ツ)_/¯
    Posts
    87
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Fully explain /scripts/restorepkg

    Happy to help.

    --force
    If there's one thing I advise, it's to never use this flag unless you've exhausted normal means of restoring the account. Even then, I'd prefer you contact cPanel support instead so we can figure out what's going on. This option essentially instructs restorepkg to disregard all logic that we put in place to prevent conflicts when an account is being restored.

    If the backup you're restoring does contain actual conflicts (domains owned by other users for example), then this sets you up for a world of hurt and unexpected behavior. I see all too often where a sysadmin has forced an account to be restored that conflicts with already existing accounts onto a box.

    It does not terminate the account first; it just "shoe horn" restores it on top. The intention of this feature is if you're trying to reduce downtime or are trying to keep 'new' files (like email) that otherwise don't exist in the backup you're restoring from.

    But, personally, I would never use --force on my own personal box just for the peace of mind. I'd perform a clean terminate/restore of an account and rest assured that our restorepkg logic has guaranteed me that there are no conflicts.

    --skipres
    This stands for "Skip Reseller Privileges". Pretty self-explanatory. Using this option will ensure that reseller privileges are NOT restored (if the account had them, that is). If it's not a reseller, this argument effectively does nothing.

    --override
    This allows you to override the stock cPanel restorepkg code with your own custom written restorepkg logic if you've written some.
    Stock Code: /usr/local/cpanel/Whostmgr/Transfers.pm

    If you desire to create your own customized version, you would place it at:
    Override location: /var/cpanel/lib/Whostmgr/Transfers.pm

    Then, when you use "--override" it will call upon the override location code in lieu of the stock code. Note that if you don't have an override setup at that location, the "--override" argument effectively does nothing at all.

    --ip=(y|n|Custom IP)
    Pretty much self-explanatory.
    --ip=y
    ^-- Allocates the next available IP in the IP Pool to the account upon restore. If none available, uses shared IP.
    --ip=n
    ^-- The same as leaving this flag absent. The account will restore using the shared IP of the box.
    --ip=123.123.123.123 (Or any other valid IP)
    ^-- Attempts to allocate the specified IP to the account upon restore. If not available/does not exist, uses shared IP

    cpuser|/path/to/cpuser-file
    Self-explanitory again.
    cpuser
    Will search for archive in various common locations to try and automatically identify the backup you're requesting it to restore. If it cannot find it, it will instruct you where it looked and what it was trying to find.
    /path/to/cpuser-file
    Simply attempts to restore using the archive that the path specifies.

    ----

    Hope this helps!

  3. #3
    Registered User
    Join Date
    Jan 2012
    Posts
    1
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Fully explain /scripts/restorepkg

    Great post about restorepkg, appreciate the extra info. I have one related question though:

    Is the --force flag used in the WHM functions that restore an account from backup that already exists on the server? I'm referring to the daily/weekly/monthly backups. I would be interested in replicating what it does through ssh.

  4. #4
    Registered User
    Join Date
    Nov 2011
    Posts
    3
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Fully explain /scripts/restorepkg

    one small query

    root@xxxxxxx [/home]# /scripts/restorepkg --force xxxxxxx

    restorepkg [--force] [--skipres] [--override] [--ip=(y|n|Custom IP)] -- [cpuser|/path/to/cpuser-file]

    To specify a dedicated IP for a restored account, the "--ip" option requires an argument of "y" for yes,
    or "n" for no. Additionally, an IP argument may be specified to set the desired dedicated IP.

    Security Note: It is recommended that you do not restore a package from an untrusted source.
    If you choose to ignore this warning, you should use --skipres to minimize the risk.

    What should be done , why this happening

  5. #5
    cPanel Development cpanelkenneth's Avatar
    Join Date
    Apr 2006
    Posts
    3,788
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Fully explain /scripts/restorepkg

    You need to put -- between the arguments and the user name:

    /scripts/restorepkg --force -- cpanelkenneth
    Kenneth
    Product Manager
    cPanel, Inc.

  6. #6
    Registered User
    Join Date
    Apr 2012
    Posts
    1
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Fully explain /scripts/restorepkg

    /scripts/restorepkg --force --ip=y -- xxx

    how is wrong that command


    root@srv1 [/home]# /scripts/restorepkg --force --ip=y -- xxx
    restorepkg [--force] [--skipres] [--override] [--ip=(y|n|Custom IP)] -- [cpuser|/path/to/cpuser-file]

    To specify a dedicated IP for a restored account, the "--ip" option requires an argument of "y" for yes,
    or "n" for no. Additionally, an IP argument may be specified to set the desired dedicated IP.

    Security Note: It is recommended that you do not restore a package from an untrusted source.
    If you choose to ignore this warning, you should use --skipres to minimize the risk.

    --------------------

    and i'm tried to that


    root@srv1 [/home]# /scripts/restorepkg --force --ip=y --skipres -- xxx
    restorepkg [--force] [--skipres] [--override] [--ip=(y|n|Custom IP)] -- [cpuser|/path/to/cpuser-file]

    To specify a dedicated IP for a restored account, the "--ip" option requires an argument of "y" for yes,
    or "n" for no. Additionally, an IP argument may be specified to set the desired dedicated IP.

    Security Note: It is recommended that you do not restore a package from an untrusted source.
    If you choose to ignore this warning, you should use --skipres to minimize the risk.
    root@srv1 [/home]#

  7. #7
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: Fully explain /scripts/restorepkg

    I just used "/scripts/restorepkg --force --ip=y username" on my machine and it worked to restore the account. Could you try removing the -- before the username to see the results?
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads & Tags
Similar threads

  1. /scripts/restorepkg question - can 2 or more restorepkg run at the same time?
    By sharmaine001 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 03-05-2010, 10:54 AM
  2. /scripts/restorepkg mailman chowning
    By sparek-3 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 11-11-2009, 04:51 PM
  3. /scripts/restorepkg ?
    By meeven in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 03-11-2008, 06:47 PM
  4. Bug(s) in /scripts/restorepkg
    By marty_parish in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 01-12-2008, 09:13 PM
  5. /scripts/restorepkg errors
    By ANewDay in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 05-19-2007, 01:47 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube