Force backup to run using new 11.38 system

Status
Not open for further replies.

ES - George

Well-Known Member
PartnerNOC
Jun 12, 2011
179
25
68
UK
cPanel Access Level
DataCenter Provider
Twitter
/scripts/cpbackup --force

"The cpbackup script can be used to manually trigger system wide backups on your cPanel & WHM server."

I would suggest reviewing this page for more: Command Line Scripts | cPanel, Inc.
 

simonas

Well-Known Member
Apr 21, 2013
141
0
16
Lithuania
cPanel Access Level
Root Administrator
Also it should be noted that you must disable legacy backup and enable new backup system on every account!
Otherwise calling above command will do nothing (no accounts)

To enable new backing system go to:
Backup User Selection

Disable legacy backup and enable new backup system for accounts.

Then above command /usr/local/cpanel/bin/backup will work and will force backup.
 
Last edited:

InterServed

Well-Known Member
Jul 10, 2007
268
14
68
cPanel Access Level
DataCenter Provider
You can also use the API calls to facilitate mass enable/disable until this options will be available directly on the WHM interface.

Constructs do exist for enabling or disabling all users within API1.

The following will enable legacy backups for all accounts

Code:
https://<hostname>:2087/<session_token>/xml-api/backup_skip_users_all?api.version=1&backupversion=legacy_backups&state=1
The following will disable legacy backups for all accounts.

Code:
https://<hostname>:2087/<session_token>/xml-api/backup_skip_users_all?api.version=1&backupversion=legacy_backups&state=0
The following will enable all accounts for the new backup system.

Code:
https://<hostname:2087/<session_token>/xml-api/backup_skip_users_all?api.version=1&backupversion=backups&state=1
The following will disable all users from using the new backup system.

Code:
https://<hostname>:2087/<session_token>/xml-api/backup_skip_users_all?api.version=1&backupversion=backups&state=0
Running any of the mentioned API calls will take some time to update (depending on how many accounts your machine has). Took me an average 10 minutes to disable legacy backup on 300 accounts.
 
Last edited:

ddshadow

Member
Nov 18, 2011
11
0
51
cPanel Access Level
Root Administrator
Hello,

The call for the new backup system originates at /usr/local/cpanel/bin/backup
Hi!

My question is,

On the new backup Is there still the hooks for doing the Precpbackup and postcpbackup??

Looking at the script i don't see any mention to the precpbackup, But i do see a Postcpbackup.

if ( -e '/usr/local/cpanel/scripts/postcpbackup' && -x _ && ( !exists $$conf_ref{'POSTBACKUP'} || $$conf_ref{'POSTBACKUP'} ) )

Any ideas if we can still use those hooks?
 

ddshadow

Member
Nov 18, 2011
11
0
51
cPanel Access Level
Root Administrator
futher info that may help you...

result>
<data>
<backup_config>
<backupdir>/backup/new/</backupdir>
<usebinarypkgacct>0</usebinarypkgacct>
<backup_monthly_dates>1,15</backup_monthly_dates>
<backup_daily_enable>1</backup_daily_enable>
<prebackup>-1</prebackup>
<backupmount>0</backupmount>
<backuptype>compressed</backuptype>
<backuplogs>1</backuplogs>
<backupenable>1</backupenable>
<backup_monthly_enable>1</backup_monthly_enable>
<psqlbackup>0</psqlbackup>
<backup_daily_retention>14</backup_daily_retention>
<errorthreshhold>3</errorthreshhold>
<backupfiles>1</backupfiles>
<backupbwdata>1</backupbwdata>
<backup_monthly_retention>4</backup_monthly_retention>
<keeplocal>1</keeplocal>
<linkdest>0</linkdest>
<backupaccts>1</backupaccts>
<backupdays>0,1,2,3,4,6</backupdays>
<postbackup>0</postbackup>
<localzonesonly>1</localzonesonly>
<gziprsyncopts/>
<mysqlbackup>accounts</mysqlbackup>
</backup_config>
</data>
<metadata>
<reason>OK</reason>
<command>backup_config_get</command>
<result>1</result>
<version>1</version>
</metadata>
</result>
<!--


I would love to have the Prebackup and postbackup working.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,608
77
308
cPanel Access Level
Root Administrator
futher info that may help you...

result>
<data>
<backup_config>
<backupdir>/backup/new/</backupdir>
<usebinarypkgacct>0</usebinarypkgacct>
<backup_monthly_dates>1,15</backup_monthly_dates>
<backup_daily_enable>1</backup_daily_enable>
<prebackup>-1</prebackup>
<backupmount>0</backupmount>
<backuptype>compressed</backuptype>
<backuplogs>1</backuplogs>
<backupenable>1</backupenable>
<backup_monthly_enable>1</backup_monthly_enable>
<psqlbackup>0</psqlbackup>
<backup_daily_retention>14</backup_daily_retention>
<errorthreshhold>3</errorthreshhold>
<backupfiles>1</backupfiles>
<backupbwdata>1</backupbwdata>
<backup_monthly_retention>4</backup_monthly_retention>
<keeplocal>1</keeplocal>
<linkdest>0</linkdest>
<backupaccts>1</backupaccts>
<backupdays>0,1,2,3,4,6</backupdays>
<postbackup>0</postbackup>
<localzonesonly>1</localzonesonly>
<gziprsyncopts/>
<mysqlbackup>accounts</mysqlbackup>
</backup_config>
</data>
<metadata>
<reason>OK</reason>
<command>backup_config_get</command>
<result>1</result>
<version>1</version>
</metadata>
</result>
<!--


I would love to have the Prebackup and postbackup working.
The new backup system uses the standard hook system we introduced in 11.32 (Getting Started). Through that, bin/backup exposes both a pre and a post hook event.
 

dgbaker

Well-Known Member
PartnerNOC
Sep 20, 2002
2,576
9
343
Toronto, Ontario Canada
cPanel Access Level
DataCenter Provider
A couple of issues with the new backup system.

1. System backups will not be uploaded to any remote destinations - Kind of hard to restore a system without them, yet if on the failed machine you have lost access in most cases. These to to sent to remote destinations.

2. Due the above, no backups are done to the remote destination is you have backup system files enabled. Would be nice if that is noted when configuring the backup system.
 

ddshadow

Member
Nov 18, 2011
11
0
51
cPanel Access Level
Root Administrator
The new backup system uses the standard hook system we introduced in 11.32 (Getting Started). Through that, bin/backup exposes both a pre and a post hook event.
On version 11.36 All was working i had 2 files under the /usr/local/cpanel/scripts

precpbackup
postcpbackup
Both were call once the Cron job would be run.

With the version 11.38 None of them are been call, so i am not sure if i need change them into the new backup script place, or if i need do something in the etc/cpbackup.conf.

Please Advise
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,608
77
308
cPanel Access Level
Root Administrator
A couple of issues with the new backup system.

1. System backups will not be uploaded to any remote destinations - Kind of hard to restore a system without them, yet if on the failed machine you have lost access in most cases. These to to sent to remote destinations.

2. Due the above, no backups are done to the remote destination is you have backup system files enabled. Would be nice if that is noted when configuring the backup system.
For item number one, please read System Backups

For item number two, do you have both Backup Accounts and Backup System Files enabled?
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,608
77
308
cPanel Access Level
Root Administrator
Could you let us know how to enable the precpbackup and postcpbackup?
You need to switch to the Standard Hook system, as I mentioned earlier. The hook event you want is System::Backup. There is both a pre and post stage, which roughly approximates precpbackup and postcpbackup. The System::Backup event is in the process of being documented, it was overlooked.
 

ddshadow

Member
Nov 18, 2011
11
0
51
cPanel Access Level
Root Administrator
You need to switch to the Standard Hook system, as I mentioned earlier. The hook event you want is System::Backup. There is both a pre and post stage, which roughly approximates precpbackup and postcpbackup. The System::Backup event is in the process of being documented, it was overlooked.
Hello!

I am aware that am not a seasoning cPanel Admin, but i have no clue what you are talking about.

Under the "Manage hooks" Version 11.38:
Home »Development »Manage Hooks

There is no mention to backups.

If i look on switch to the Standard Hook system, I don't get nothing.

Could you point me out to the right direction please?
 

BrentH

Registered
Mar 19, 2012
3
0
51
cPanel Access Level
Root Administrator
So, am I missing something here or do you have to manually select EVERY use account you want to back up? Is there not an option to select all?!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
So, am I missing something here or do you have to manually select EVERY use account you want to back up? Is there not an option to select all?!
This feature will be included in cPanel version 11.38.1 per internal case number 70329. In the meantime, the following API calls can be made as a workaround:

Code:
[WHM:port]/[cpsession]/json-api/backup_skip_users_all?api.version=1&state=disable&backupversion=legacy_backup
[WHM:port]/[cpsession]/json-api/backup_skip_users_all?api.version=1&state=enable&backupversion=backup
Thank you.
 

tsiedsma

Active Member
Nov 1, 2006
27
0
151
US
cPanel Access Level
Root Administrator
It appears that cpbackup-userskip.conf is ignored by the new backup system. Is there a way to add users to a skip list like before? Internal processes run and scan accounts that violate our backup policy, the accounts are added to this file and backups are skipped. It appears those accounts are actually being backed up by the new system.
 
Status
Not open for further replies.