Git Product home page Git Product logo

localbkup's Introduction

Local Bkup

A small script to run a backup locally using python+tar+gpg for compression + encryption.

Configuration

A configuration file is expected to exist on ~/.config/localbkup.json. Because the file contains raw passwords, make sure it has 600 permissions, so they are not readable for other users.

Those are the acceptable keys:

  • files: An array of all files that will be given to tar for generating the backup.
  • exclude: An array of files to exclude, given to tar’s --exclude.
  • password: The password using for encrypting the file.
  • destination_folder: The folder where bkups will be saved.

Here is an example:

{
  "files": [
    "/Users/myuser/.zshrc",
    "/Users/myuser/.config",
    "/Users/myuser/.skhdrc"
  ],
  "exclude": [
    "*.pyc"
  ],
  "destination_folder": "/Users/myuser/Google Drive File Stream/My Drive/backups/localbkup",
  "password": "a very secret password"
}

Scheduling

To schedule it to run everyday at 12:03, do the following:

  1. Copy the file ./launchd/localbkup.plist to ~/Library/LaunchAgents/localbkup.plist
  2. Edit the copied file, and EVERYWHERE where it’s written ${HOME} write your home path.
  3. Now run launchctl load -w ~/Library/LaunchAgents/localbkup.plist
  4. And run launchctl enable user/$(id -u)/localbkup

Single run

If you want to run the backup once, you can use launchctl:

launchctl start localbkup

In order to see the logs, you can just stream the logging file

tail -f ~/.local/var/log/localbkup_launchd.log

Usage

usage: localbkup.py [-h] [-c CONFIG]

Makes a local backup of a list of files into a destination folder.

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        Configuration file. Defaults to /Users/vitorbarbosa/.config/localbkup.json.

Development

make test
/usr/local/bin/python3 -m unittest tests
...........
----------------------------------------------------------------------
Ran 11 tests in 0.010s

OK

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.