Skip to content

Instantly share code, notes, and snippets.

@amphineko
Last active September 10, 2024 23:55
Show Gist options
  • Save amphineko/37183f9f43221864e8d47001c883c4ca to your computer and use it in GitHub Desktop.
Save amphineko/37183f9f43221864e8d47001c883c4ca to your computer and use it in GitHub Desktop.

proxmox-backup-client.{service,timer}

Usage

Populates files to the backup client host:

/etc/systemd/system/[email protected]
/etc/systemd/system/[email protected]
/etc/systemd/system/proxmox-backup-client.env

Decides the backup spec:

<archive-name>.<type>:<source-path>

hikari.pxar:/mnt/vms/hikari

Run once:

systemctl start proxmox-backup-client@$(systemd-escape "hikari.pxar:/mnt/vms/hikari")

Run every other day using systemd-timer:

systemctl start proxmox-backup-client@$(systemd-escape "hikari.pxar:/mnt/vms/hikari").timer

Check active systemd-timers:

systemctl list-timers --all "proxmox-backup-client@*"
PBS_REPOSITORY="svc-backup-client@pbs!<api_token_name>@<pbs_hostname>:<datastore>"
PBS_PASSWORD="<api_token_secret>"
PBS_FINGERPRINT="<pbs_fingerprint>"
[Unit]
Description=One-shot script to run proxmox-backup-client
[Service]
Type=oneshot
EnvironmentFile=/etc/systemd/system/proxmox-backup-client.env
ExecStartPre=/bin/sh -c "set -- $(echo '%I' | sed '0,/:/s/:/ /') && [ -d $2 ]"
ExecStart=/usr/bin/proxmox-backup-client backup --backup-type vm '%I'
[Unit]
Description=Run proxmox-backup-client every other day
[Timer]
OnActiveSec=2d
Persistent=true
[Install]
WantedBy=timers.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment