[GH-ISSUE #71] Can this be made possible to run locally on the proxmox server shell? #69

Closed
opened 2026-02-26 17:44:15 +03:00 by kerem · 3 comments
Owner

Originally created by @chrcoluk on GitHub (Dec 2, 2022).
Original GitHub issue: https://github.com/Corsinvest/cv4pve-autosnap/issues/71

It seems to be a requirement to run it remotely.

Originally created by @chrcoluk on GitHub (Dec 2, 2022). Original GitHub issue: https://github.com/Corsinvest/cv4pve-autosnap/issues/71 It seems to be a requirement to run it remotely.
kerem closed this issue 2026-02-26 17:44:15 +03:00
Author
Owner

@franklupo commented on GitHub (Dec 2, 2022):

Hi,
you can run everywhere.

Best regards

<!-- gh-comment-id:1335439081 --> @franklupo commented on GitHub (Dec 2, 2022): Hi, you can run everywhere. Best regards
Author
Owner

@turrini commented on GitHub (Jan 4, 2023):

Hi, to achieve redundancy, this is what I'm doing:

Have a directory structure like this in any of the hosts:

/opt/tools/bin/cv4pve-autosnap           (binary)
/opt/tools/etc/cron.d/cv4pve-autosnap    (crontab file)
/opt/tools/scripts/cv4pve-autosnap.sh    (shell script)

ln -s /opt/tools/etc/cron.d/cv4pve-autosnap /etc/cron.d/

Install syncthing on all hosts to keep /opt/tools synchronized automatically

(syncthing.net -> apt-get install syncthing, enable it and configure)

The script (/opt/tools/scripts/cv4pve-autosnap.sh):

#!/bin/bash

if [[ -z "$2" ]]; then
    echo "Usage: $(basename $0) <label> <# keep> [all]"
    exit 1
fi

snapshot_user="autosnap@pve"
snapshot_password="XXXXXXXXXXX"

label="$1"
keep="$2"
[[ -z "$3" ]] && what="all" || what="$3"

# Only run if this host is the cluster master
is_master=$(/usr/sbin/ha-manager status | grep -m 1 -o "^master $(hostname -s)")
if [[ ! -z "${is_master}" ]]; then
    /opt/tools/bin/cv4pve-autosnap \
        --host=127.0.0.1 \
        --username=${snapshot_user} \
        --password=${snapshot_password} \
        --vmid="${what}" \
        snap \
        --label="${label}" \
        --keep="${keep}" \
        --only-running
fi


The cron file (/opt/tools/etc/cron.d/cv4pve-autosnap):

# Snapshot
0 0     * * *   root   /opt/tools/scripts/cv4pve-autosnap.sh daily 5 all
0 */1   * * *   root    /opt/tools/scripts/cv4pve-autosnap.sh hourly 8 all

This is far from the best way to do it probably, but it works for me :)

<!-- gh-comment-id:1371232375 --> @turrini commented on GitHub (Jan 4, 2023): Hi, to achieve redundancy, this is what I'm doing: ## Have a directory structure like this in any of the hosts: ``` /opt/tools/bin/cv4pve-autosnap (binary) /opt/tools/etc/cron.d/cv4pve-autosnap (crontab file) /opt/tools/scripts/cv4pve-autosnap.sh (shell script) ``` ## Link the crontab so the system cron can reach and execute `ln -s /opt/tools/etc/cron.d/cv4pve-autosnap /etc/cron.d/` ## Install syncthing on all hosts to keep /opt/tools synchronized automatically `(syncthing.net -> apt-get install syncthing, enable it and configure)` ## The script (/opt/tools/scripts/cv4pve-autosnap.sh): ```bash #!/bin/bash if [[ -z "$2" ]]; then echo "Usage: $(basename $0) <label> <# keep> [all]" exit 1 fi snapshot_user="autosnap@pve" snapshot_password="XXXXXXXXXXX" label="$1" keep="$2" [[ -z "$3" ]] && what="all" || what="$3" # Only run if this host is the cluster master is_master=$(/usr/sbin/ha-manager status | grep -m 1 -o "^master $(hostname -s)") if [[ ! -z "${is_master}" ]]; then /opt/tools/bin/cv4pve-autosnap \ --host=127.0.0.1 \ --username=${snapshot_user} \ --password=${snapshot_password} \ --vmid="${what}" \ snap \ --label="${label}" \ --keep="${keep}" \ --only-running fi ``` ## The cron file (/opt/tools/etc/cron.d/cv4pve-autosnap): ``` # Snapshot 0 0 * * * root /opt/tools/scripts/cv4pve-autosnap.sh daily 5 all 0 */1 * * * root /opt/tools/scripts/cv4pve-autosnap.sh hourly 8 all ``` This is far from the best way to do it probably, but it works for me :)
Author
Owner

@franklupo commented on GitHub (Jan 5, 2023):

You can run cv4pve-autosnap outside the cluster or in a vm or ct.

<!-- gh-comment-id:1371909424 --> @franklupo commented on GitHub (Jan 5, 2023): You can run cv4pve-autosnap outside the cluster or in a vm or ct.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cv4pve-autosnap#69
No description provided.