Coder Social home page Coder Social logo

lxd-tools's Introduction

lxd-tools

LXD Powertool

Capable of updating, snapshotting, backing up and migrating containers individually or en-masse.

Can also mass clean existing snapshots and backups (assuming they have the container's name in their filename) for one container or all containers.

Useful for automation.

Tested on LXD 3.20 running in Snap on Fedora 30


Capable of updating containers running:

  • Ubuntu, Debian, Devuan, Kali, Linux Mint
  • Alpine Linux
  • CentOS, Fedora
  • Arch Linux

Want to add your own? See: distroCommand


CONFIGURATION OPTIONS:

Modify the script to change these if required.

runCommands = 1
debug = 0
lxcPath = "/snap/bin/lxc" # YOU WILL MOST LIKELY NEED TO CHANGE THIS
lxdBridge = "lxdbr0"
backupFolder = CURRENT WORKING DIRECTORY + "/lxd-backups/"
sortListBy = "ipv4"
sortListReverse = False

PARAMETERS:

help
list [backups/snapshots]
update <container-name/ALL>
snapshot <container-name/ALL>
backup <container-name/ALL>
migrate <container-name/ALL> <storage-pool> <remote-name>
cleanup <snapshots/backups> <container-name/ALL>
set-ipv4 <container-name> <ipv4>

DISCLAIMER

Could horribly break everything!

I take no responsibility over the use of this random unofficial LXD helper script you found on the Internet.

Use with runCommands = 0 and debug = 1 if you want a list of commands generated by this script instead of actually running them.

REQUIREMENTS:

  • python3.x
  • PrettyTable
sudo pip3 install PrettyTable

RUNNING:

chmod +x lxd-tools
./lxd-tools <parameters>

INSTALLING TO SYSTEM:

(OPTIONAL)

sudo pip3 install PrettyTable
git clone https://github.com/unendingPattern/lxd-tools.git
sudo cp -f lxd-tools/lxd-tools /usr/local/bin
sudo chmod +x /usr/local/bin/lxd-tools
lxd-tools <parameters>

OR

sudo pip3 install PrettyTable
sudo wget -O /usr/local/bin/lxd-tools https://github.com/unendingPattern/lxd-tools/raw/master/lxd-tools
sudo chmod +x /usr/local/bin/lxd-tools
lxd-tools <parameters>

USING WITH CRONTAB:

Backup all containers at midnight:

0 0 * * * path/to/lxd-tools backup ALL

Backup a specific container at 04:05 AM:

5 4 * * * path/to/lxd-tools backup specific-container

SCREENSHOTS:

[IMG] [IMG] [IMG] [IMG] [IMG] [IMG] [IMG] [IMG]

lxd-tools's People

Contributors

researcx avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.