GithubHelp home page GithubHelp logo

simhaonline / lxdbackup Goto Github PK

View Code? Open in Web Editor NEW

This project forked from maltekiefer/lxdbackup

0.0 0.0 0.0 31 KB

Bash script to backup and sync lxd container to external/internal repo

License: MIT License

Shell 100.00%

lxdbackup's Introduction

lxdBackup

Installation

To install lxdBackup you only have to clone the repo.

git clone https://codeberg.org/beli3ver/lxdBackup

To run the program just add the path to your enviroment Path variable or just do:

bash lxdBackup.sh

Attention: without parameter the program will do nothing

Running

To run the backup program you must start it with one of these parameters:

	-a | --all                    backup all container
	-cj | --cron                  backup script im cron modus, look in the docu for more information
	-c= | --container=            backup container
	-d= | --dir=                  path to the backup dir
	-doi | --delete-old-images    delete old images
	-doa | --delete-old-archives  delete old archives
	-s= | --sshport=              SSH Port
	-rs= | --rsyncpath=           Path for rsync target
	-h | --help                   show this help message
	-p= | --pass=                 password for gpg encryption
	-v | --version                print version & third party version

The easiest would be to do:

/usr/bin/bash lxdBackup.sh --all

Cron

To run the software in the cron modus start it with this parameter:

/usr/bin/bash lxdBackup.sh --cron

It is important that on of these two paramter is set:

export ALL_CONTAINER=y

or

export LXCCONTAINER=name-of-the-container

optional you can change the backup dir

export BACKUPDIR=/backup/

For GPG support look at the GPG section.

To get a log when you run the program in the cron mode just do something like this in your crontab:

#that will run every 4 hours
0 */4 * * * /usr/bin/bash /path/to/lxdBackup/lxdbackup.sh --cron > /path/to/log

GPG

To use the GPG encryption you must set the a GPG passphrase as a enviroment variable or at the begining of the script call:

/usr/bin/bash lxdBackup.sh --pass=myStrongPassword --all

Attention: It is important that the --pass= is the first parameter when you call the script!

The enviroment variable looks like this:

export GPGPASS=myStrongPassword

/usr/bin/bash lxdBackup.sh --all

Log

Sample log output:

 [01/16/2020 08:47:54] [INFO] Snapshot: Succesfully created snaphot 01-16-20-08-47 on container proxy
 [01/16/2020 08:47:54] [INFO] Publish: Succesfully published an image of proxy-BACKUP-01-16-20-08-47 to proxy-BACKUP-01-16-20-08-47-IMAGE
 [01/16/2020 08:47:54] [INFO] Image: Succesfully exported an image of proxy-BACKUP-01-16-20-08-47-IMAGE to /tmp/lxdbackup/proxy-BACKUP-01-16-20-08-47-IMAGE.tar.gz
 [01/16/2020 08:47:54] [INFO] Archiv: Succesfully encrypted
 [01/16/2020 08:47:54] [INFO] ##################################################
 [01/16/2020 08:47:54] [INFO] ### Your GPG Password: myStrongPassword ###
 [01/16/2020 08:47:54] [INFO] ##################################################

lxdbackup's People

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.