Problems with proxmox-backup-client command and crontab

Meister177

New Member
May 3, 2024
7
1
3
Hi,
currently I'm trying to run the backups via crontab.

I'll keep the examples as small as possible, therefore I explain my problem using the proxmox-backup-client list command.

When I run the command in the CLI directly (logged in as root on my Proxmox server), everything is working as intended.
Bash:
proxmox-backup-client list --repository 'user@pbs!Token@IPv4:Datastore'

Then I created two files.
  1. .pbs.env containing
    1. Bash:
      PBS_REPOSITORY=user@pbs!Token@IPv4:Datastore
      PBS_PASSWORD=secret
  2. pbs-test.sh containing
    1. Bash:
      #!/bin/bash
      
      source /root/.pbs.env
      
      proxmox-backup-client list --repository "$PBS_REPOSITORY"

When I run the script directly in the CLI it still works but as soon as I run it via cron or via
Code:
env -i /root/pbs-test.sh
it does not work and I get the error message
Error: error building client for repository user@pbs!TockenName@IPv4: DatastoreName - API token secret must be provided!

I already read many threads here but nothing seems to work. I may miss something obvious here but I just can't see it.

Does anyone has an idea what I'm doing wrong?

Thank you very much