UAPI fullbackup file name issue

ale.ab

Member
Jul 9, 2013
6
0
1
cPanel Access Level
Root Administrator
Hello,
i need to create a fullbackup and upload to customer's sftp server (extra my system backup).

i can upload correctly with this script

/usr/bin/uapi --user=cpaneluser Backup fullbackup_to_scp_with_password host=remote.server.com port=22 username=remoteuser password=12345678 directory=/home/ale/YYYY-MM-DD--HH-mm-username.tar.gz [email protected]

backup works correctly but filename on remote server is
YYYY-MM-DD--HH-mm-username.tar.gz
i would is
2019-05-03--11-04-cpaneluser.tar.gz


in documentation
UAPI Functions - Backup::fullbackup_to_scp_with_password - Developer Documentation - cPanel Documentation
seems i can use fileformat with YYYY ecc...


where i wrong?

thank you
 

kdub

Active Member
Apr 19, 2019
29
8
3
California
cPanel Access Level
Root Administrator
backup works correctly but filename on remote server is
YYYY-MM-DD--HH-mm-username.tar.gz
i would is
2019-05-03--11-04-cpaneluser.tar.gz
If I'm reading this correctly, your issue is that when you run this from command line the backup filename being set is using the literal 'username' and you would like it to substitute the literal with the actual username of the cpanel user that the backup belongs to, as in the cpanel account for which the backup is being made?

How are you calling this? Could you not just simply type in the username you used for --user? like `YYYY-MM-DD--HH-mm-cpaneluser.tar.gz`

Edit: the argument you provide for "directory" is the directory on the remote server that you want to store the backup archive in, not the backup archive filename. It probably shouldn't be a file. As far as I can tell the naming convention that cPanel uses for backup archives it creates is hard coded, meaning there is no setting that allows you to change it. If your goal is just to track the cpanel user that backups belong to, you could just do something like 'directory=/home/ale/cpaneluser' and leave the tar filenames as cpanel makes them.
 
Last edited:

ale.ab

Member
Jul 9, 2013
6
0
1
cPanel Access Level
Root Administrator
correct, the filename on remote server is YYYY... and not 2019....

but i found a solution....

i run command in ssh
Code:
/usr/bin/uapi --user=cpaneluser Backup fullbackup_to_scp_with_password host=remote.server.com port=22 username=remoteuser password=12345678 directory=/home/ale/$(date +%Y-%m-%d--%H.%M.%S)--cpaneluser.tar.gz [email protected]
this create a fullbackup and upload on remote server i path
/home/ale/
and filename is (for example)
2019-05-04--10.14.12--cpaneluser.tar.gz

so for me issue is solved.

thank you