[SOLVED] Incomplete execution of a backup script

Cromatin

New Member
Jan 30, 2022
4
0
1
For a holiday Minecraft event, I have acquired a server through a third party (server at home does not have enough power).
And I wanted to make a backup on my PBS every 4 hours, since it is located in my house network I have to connect via VPN to execute the backup and then disconnect again.

I have written a bash script for this purpose:
Bash:
#!/bin/sh

# Timestamp
echo ---- START $(date +'%d.%m - %H:%M') ----

# Connect to remote network
wg-quick up cs2-pbs

# Create the Backup
export PBS_PASSWORD=
export PBS_REPOSITORY=
proxmox-backup-client backup root.pxar:/opt/createlive4 --backup-id Create-Something_2 --rate 531250
export PBS_PASSWORD=
export PBS_REPOSITORY=

# Disconnect from the remote network
wg-quick down cs2-pbs

# Timestamp
echo ---- END $(date +'%d.%m - %H:%M') ----
(Password and repo are hidden)

I have also created a cronjob that executes this script every 4 hours.
0 */4 * * * sh /opt/cs2_auto_backup.sh >> /opt/cs2_auto_backup.log

After 4 hours had passed I opened the log, but only saw the beginning and end lines.
Also, no VPN connection was established, let alone a backup.
Code:
---- START 30.05 - 16:00 ----
---- END 30.05 - 16:00 ----

When I run the script manually it runs correctly, only the cronjob seems to cause problems.
Would help a lot to finally find the problem, after I have been trying to fix it for days.
 

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!