Giter Site home page Giter Site logo

kopyat's Introduction

Kopyat

Kopyat is my Swiss Army knife for backup and sync related tasks. The name Kopyat comes from 2 words: kopya (Turkish for "copy") and cat -> copycat.

Functionalities:

  • Serve as a wrapper for backup programs (for now, only supported backup program is restic), optionally providing ifile support.
  • Generate ifile (.stignore) for syncthing directories.

Ifile

Ifile is a type of file generated from .gitignore and .kopyatignore (same format as .gitignore) files found inside the directory tree.

"I" of the ifile stands for both ignore and include. For restic backups, it generates an simple straightforward include file, and for syncthing, it generates an ignore file (.stignore).

Build

git clone https://github.com/karagenc/kopyat
cd kopyat
make

Config

Note: Paths in config are relative to the config file. Exception to this are backup base path and backup paths. They must be absolute in order for ifile to be generated without problems.

Environment variables

  • KOPYAT_CONFIG
  • KOPYAT_STATE_DIR
  • KOPYAT_SCRIPT
    • Set to 1 only inside Go hooks.

Hooks (Scripts)

Kopyat can run hooks before or after backup and ifile generation operations. Hooks are simply Go source files with an init function. Save the code snippet below as hello.go, and run it with: kopyat run-script hello.go

package x
//      ^ package name can be anything, including main.

import "fmt"

func init() {
  fmt.Println("Hello from hook script")
}

To access context-specific information, import kopyat and:

package x
//      ^ package name can be anything, including main.

import "github.com/karagenc/kopyat"

func init() {
  // Get Kopyat context.
  // Only for backup and ifile generation hooks.
  c := kopyat.GetContext()
  // Access context
  // ...
}

kopyat's People

Contributors

karagenc 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.