[Solved] proxmox-backup-client new Environment Variables

macromoon

Member
Aug 6, 2024
59
2
8
Hi, colleagues. How ca create new variable for path bkp as PBS_REPOSITORY, etc...? I want bkp only last data file in folder:
Code:
# ls /mnt/sqlbkp01/Fesapp/Day/
Fesapp.Day_2025-03-16.zip  Fesapp.Day_2025-03-24.zip  Fesapp.Day_2025-04-01.zip  Fesapp.Day_2025-04-09.zip
Fesapp.Day_2025-03-17.zip  Fesapp.Day_2025-03-25.zip  Fesapp.Day_2025-04-02.zip  Fesapp.Day_2025-04-10.zip
Fesapp.Day_2025-03-18.zip  Fesapp.Day_2025-03-26.zip  Fesapp.Day_2025-04-03.zip  Fesapp.Day_2025-04-11.zip
Fesapp.Day_2025-03-19.zip  Fesapp.Day_2025-03-27.zip  Fesapp.Day_2025-04-04.zip  Fesapp.Day_2025-04-12.zip
Fesapp.Day_2025-03-20.zip  Fesapp.Day_2025-03-28.zip  Fesapp.Day_2025-04-05.zip  Fesapp.Day_2025-04-13.zip
Fesapp.Day_2025-03-21.zip  Fesapp.Day_2025-03-29.zip  Fesapp.Day_2025-04-06.zip  Fesapp.Day_2025-04-14.zip
Fesapp.Day_2025-03-22.zip  Fesapp.Day_2025-03-30.zip  Fesapp.Day_2025-04-07.zip  Fesapp.Day_2025-04-15.zip
Fesapp.Day_2025-03-23.zip  Fesapp.Day_2025-03-31.zip  Fesapp.Day_2025-04-08.zip
Get full path file:
Code:
# ls -dtr1 /mnt/sqlbkp01/Fesapp/Day/* | tail -1
/mnt/sqlbkp01/Fesapp/Day/Fesapp.Day_2025-04-15.zip
Use .bashrc for set this variable:
Code:
function pathbkp_FesappDay() {
ls -dtr1 /mnt/sqlbkp01/Fesapp/Day/* | tail -1;
}
get path file:
Code:
# pathbkp_FesappDay
/mnt/sqlbkp01/Fesapp/Day/Fesapp.Day_2025-04-15.zip
When use this variable get error:
Code:
# proxmox-backup-client backup Fesappday.pxar:pathbkp_FesappDay
Error: unable to access 'pathbkp_FesappDay' - No such file or directory (os error 2)
 
Last edited:
that's not really a PBS question, but a shell question.. you need to actually call the function and pass its output/result to the proxmox-backup-client invocation. there's multiple ways to do it
- put it into a variable and use that when calling proxmo-backup-client
- call it inline using a subshell
- ..
 
that's not really a PBS question, but a shell question.. you need to actually call the function and pass its output/result to the proxmox-backup-client invocation. there's multiple ways to do it
- put it into a variable and use that when calling proxmo-backup-client
- call it inline using a subshell
- ..
hi, Fabian! Unfortunately variable not support in path for proxmox-backup-client backup <name>:<path>
Always result: Error: unable to access 'pathbkp_FesappDay' - No such file or directory (os error 2)
 
Last edited:
you need to call proxmox-backup-client using a shell, and let the shell expand the variable..
 
you are using a token, maybe you forgot to assign privileges to the token itself?
 
  • Like
Reactions: macromoon
you are using a token, maybe you forgot to assign privileges to the token itself?
Fabian, pbs client cant bkp one file?

Code:
# proxmox-backup-client backup 1.pxar:/mnt/sqlbkp01/Fesapp/Day/Fesapp.Day_2025-04-16.zip --skip-lost-and-found
Error: got unexpected file type (expected directory)
 
I need backup only one file. How i can do it? Folder backup OK, file, not...

Code:
root@pbs01:~# proxmox-backup-client backup 1.pxar:/mnt/sqlbkp01/Fesapp/Day/Fesapp.Day_2025-04-16.zip --repository 'cifsbkp@pbs!backuptoken@localhost:PBS_Backup_sql_day'
Error: got unexpected file type (expected directory)
root@pbs01:~# proxmox-backup-client backup 1.pxar:/mnt/sqlbkp01/Fesapp/Day/ --repository 'cifsbkp@pbs!backuptoken@localhost:PBS_Backup_sql_day'
Starting backup: host/pbs01/2025-04-16T09:11:39Z
Client name: pbs01
Starting backup protocol: Wed Apr 16 12:11:39 2025
No previous manifest available.
Upload directory '/mnt/sqlbkp01/Fesapp/Day/' to 'cifsbkp@pbs!backuptoken@localhost:8007:PBS_Backup_sql_day' as 1.pxar.didx
1.pxar: had to backup 4.7 GiB of 4.7 GiB (compressed 4.7 GiB) in 17.75 s (average 271.171 MiB/s)
Uploaded backup catalog (1.125 KiB)
Duration: 17.78s
End Time: Wed Apr 16 12:11:56 2025
 
yes, I already told you how - you need to back it up as raw image file as a fixed index (fidx), not as a directory tree/pxar archive (didx). simply change the ".pxar" to ".img"
 
  • Like
Reactions: macromoon