/scripts/restorepkg behavior

GOT

Get Proactive!
PartnerNOC
Apr 8, 2003
1,755
316
363
Chesapeake, VA
cPanel Access Level
DataCenter Provider
When using /scripts/restorepkg command to restore an account from a backup without terminating it first, does it do the following:

Files in homedir (mail, public_html) that have been removed from the backup but still exist on the live site, are tehr emoved files removed, or do they remain?

Databases that were dropped and do not not exist in the backup, are they dropped when restoring the account?

I'm basically syncing backups from a production environment and restoring them on a standby server and I am wondering if I need to terminate the accounts first, or can I simply restore them with the --force option?
 

GOT

Get Proactive!
PartnerNOC
Apr 8, 2003
1,755
316
363
Chesapeake, VA
cPanel Access Level
DataCenter Provider
Did some testing and deleted files in the backup are deleted from the userdir when restored, so that's good. Will be testing the databases over the next couple of days.
 

24x7serversecurity

Active Member
Aug 31, 2015
39
6
8
India
cPanel Access Level
Root Administrator
Hey :),

When your restore any account using --force option, the account gets forcefully overwritten with all the files, databases etc. So if anything doesn't exist in the backup but exists in the account, will get deleted when your restore the account.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463
Hello,

Documentation on /scripts/restorepkg is available at:

Restore Package Script - Documentation - cPanel Documentation

Using the --force flag restores the account, and any existing data remains intact on the server. Thus, it's likely a good idea to terminate the account first, then restore it, if you want it to completely match the backup archive contents.

Thank you.