Proxmox Backup Client Schedule

Hunv

New Member
Jul 25, 2022
9
0
1
Hi,

I am currently fighting since hours with configuring a cron job to perform the backup on a schedule for a physical server I have using the Proxmox backup client.
I have a Debian system and perform the following as root. What I did so far:
I used crontab -e to schedule a hourly backup using the following line:
Code:
28 * * * * /etc/profile.d/pbs_env.sh; /usr/bin/proxmox-backup-client backup webserver.pxar:/ --repository backupuser@pbs@192.168.1.10:BackupDisk
the content of the pbs_env.sh (it is executable) looks like this:
Code:
#!/bin/sh
export PBS_PASSWORD="myPassword"
export PBS_FINGERPRINT="myFingerprint"

This does not work. The syslog says the command is executed, but nothing happens. If I put a > ~/mylog1.txt and ~/mylog2.txt to the end of both commands of the line, the files are created but stay empty.
If I run the command manually it works of cause.

After the crontab -e didn't worked, I tried it by creating a file at /etc/cron.d with the following content:
Code:
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

3 * * * * root /etc/profile.d/pbs_env.sh && /usr/bin/proxmox-backup-client backup webserver.pxar:/ --repository backupuser@pbs@192.168.1.10:BackupDisk
This also don't work.
Now I don't know any more what I can do. I also find no tutorials/examples/documentation how it is recommended to setup a scheduled backup using the proxmox backup client.
 
Maybe the environment variables won't work when running hte script using cron? I personally made a bash script that got the...
Code:
export PBS_PASSWORD="myPassword"
export PBS_FINGERPRINT="myFingerprint"
...first and then the ...
Code:
/usr/bin/proxmox-backup-client backup webserver.pxar:/ --repository backupuser@pbs@192.168.1.10:BackupDisk
...and my crontab then runs this bash script and this works fine.
 
Maybe the environment variables won't work when running hte script using cron? I personally made a bash script that got the...
Code:
export PBS_PASSWORD="myPassword"
export PBS_FINGERPRINT="myFingerprint"
...first and then the ...
Code:
/usr/bin/proxmox-backup-client backup webserver.pxar:/ --repository backupuser@pbs@192.168.1.10:BackupDisk
...and my crontab then runs this bash script and this works fine.
Thanks for your input. That actually works.
For all noobs, I did the following:

- Logged in as root
- Created at file via nano /root/backup.sh
- Pasted the following content:
Code:
#!/bin/sh
export PBS_PASSWORD="myPassword"
export PBS_FINGERPRINT="myFingerprint"

/usr/bin/proxmox-backup-client backup webserver.pxar:/ --repository backupuser@pbs@192.168.1.10:BackupDisk
- Made the file executeable via
Code:
chmod +x /root/backup.sh
- Checked that the backup performs by running /root/backup.sh
- ran "crontab -e"
- added
Code:
28 * * * * /root/backup.sh
to run the backup every hour at minute 28.
- Done
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!