SOLVED CPANEL-35244 - backup_user_list API call not working with weekly backups

Techs-Y

Member
Sep 29, 2016
15
0
1
Germany
cPanel Access Level
Root Administrator
Hello,

We are trying to gather restore points for backup monitoring using backup_user_list API call. The issue is that while daily and monthly backups provide correct output, calls involving weekly backups return the following:

Code:
# /usr/local/cpanel/bin/whmapi1 backup_user_list restore_point=2020-08-16
---
metadata:
  command: backup_user_list
  reason: "Invalid restore point: 2020-08-16"
  result: 1
  version: 1
Backup directory is set to /backup and it contains all types of backups. So there's nothing different in ownership/permissions for weekly and monthly backup directories for example.

We have also examined .master.meta files in several backup directories and they seem to be intact (no content difference, except for order: sometimes 'accounts list' metadata goes before backup summary (date, status, etc.) and sometimes it's printed before backup summary section(we can attach examples if needed))

Can anyone please point us in the right direction regarding this odd issue?
 
Last edited:

Techs-Y

Member
Sep 29, 2016
15
0
1
Germany
cPanel Access Level
Root Administrator
Hi, thank you for your reply. 2020-08-16 backup was overwritten so I will show you another one weekly:

Bash:
# whmapi1 backup_date_list
---
data:
  backup_set:
    - 2020-09-10
    - 2020-09-08
    - 2020-09-06
    - 2020-09-05
    - 2020-09-03
    - 2020-09-01
    - 2020-08-30
    - 2020-08-23
metadata:
  command: backup_date_list
  reason: OK
  result: 1
  version: 1

# whmapi1 backup_user_list restore_point=2020-08-30
---
metadata:
  command: backup_user_list
  reason: "Invalid restore point: 2020-08-30"
  result: 1
  version: 1

# stat /backup/weekly/2020-08-30/
  File: ‘/backup/weekly/2020-08-30/’
  Size: 0             Blocks: 0          IO Block: 16384  directory
Device: 28h/40d    Inode: 50924650    Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-08-30 02:00:02.415626000 +0200
Modify: 2020-08-30 02:00:02.468762000 +0200
Change: 2020-08-30 02:00:02.468762000 +0200
 Birth: -
As you may see there is no folder /backup/2020-08-30/ but /backup/weekly/2020-08-30/ is there and backups are also there, but WHM API for some reason don't see them.
 

Techs-Y

Member
Sep 29, 2016
15
0
1
Germany
cPanel Access Level
Root Administrator
Hello,

I think, I figured out the behavior of this bug. WHM API for some reason don't expect backups at the /backups/weekly folder. I did some tests and found out that the search is performed only in /backup and /backup/monthly folders when I call whmapi1 backup_user_list restore_point= command. Below I will attach an example.

Maybe someone knows a place where I can change the code to include /backup/weekly folder? It would also be great if the cPanel developers fix this bug in next versions.

Thank you.

Let's say we have a weekly backup from 2020-10-04 and it is located at /backup/weekly folder. When I call whmapi1 backup_user_list restore_point=2020-10-04 I'm receiving "Invalid restore point":
Bash:
# whmapi1 backup_user_list restore_point=2020-10-04
---
metadata:
  command: backup_user_list
  reason: "Invalid restore point: 2020-10-04"
  result: 1
  version: 1
But if I append correct path to the command I will receive correct response:
Bash:
# whmapi1 backup_user_list restore_point=weekly/2020-10-04
---
data:
  user:
    -
      status: active
      username: user
metadata:
  command: backup_user_list
  reason: OK
  result: 1
  version: 1
 

imorandin

Member
PartnerNOC
Nov 20, 2014
17
1
53
cPanel Access Level
DataCenter Provider
@cPRex : yes, that's correct.
To "fix" the problem temporarily in my script I did this:


Bash:
if [ -d "/backup/$DATE/accounts/$USER" ] || [ -d "/backup/weekly/$DATE/accounts/$USER" ] || [ -d "/backup/monthly/$DATE/accounts/$USER" ]; then
        # THE BACKUP DOES EXIST, DO SOMETHING
fi
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
6,874
908
313
cPanel Access Level
Root Administrator