Giter VIP home page Giter VIP logo

Comments (3)

franklupo avatar franklupo commented on June 12, 2024

Hi,
you can run everywhere.

Best regards

from cv4pve-autosnap.

turrini avatar turrini commented on June 12, 2024

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):

#!/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 :)

from cv4pve-autosnap.

franklupo avatar franklupo commented on June 12, 2024

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

from cv4pve-autosnap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.